1

I have a custom template for a node (Photograph) that needs to print a field multiple times for different reasons. You can see an example here: http://history.arvadahistory.org/photograph/elizabeth-lunau-house-52st-and-dover

Where you see in the table "Individual ID", there is supposed to be a field printout, but I had to cut it out so a copy of the field could be printed with priority.

So using the above example, the Individual ID should be printed HF513, but I can't for unknown reasons, place this field in multiple places, and I need it absolutely attached to the "Order Image" button, where the link it loads for the above example is as such: http://history.arvadahistory.org/order-historic-image?edit[attributes][2]=HF513

Below is the code I have included in my template, as you can see, the second row, where the initial copy of "Individual ID" is supposed to be printed, I have commented out because if I leave it uncommented, it won't print the field the second time near the bottom with the "Order Image" button.

As a note, I do have a module that provides my fields with a "Do not write drupal standard markup around the field" option so I can print out the individual ID with just the ID to include in my "Order Image" URL.

<table width="100%" border="0">
    <tbody>
      <tr>
        <td class="category">Object ID</td>
        <td class="non-title"><?php print render ($content['field_photo_object_id']);?></td>
      </tr>
      <tr>
        <td class="category">Individual ID</td>
        <td class="non-title"><?php /**print render ($content['field_individual_id']);**/?></td>
      </tr>
      <tr>
        <td class="category">Object Name</td>
        <td class="non-title"><?php print render ($content['field_object_name']);?></td>
      </tr>
      <tr>
        <td class="category">Description</td>
        <td class="non-title"><?php print render ($content['body']);?></td>
      </tr>
      <tr>
        <td class="category">Copyright</td>
        <td class="non-title"><?php print render ($content['field_copyright']);?></td>
      </tr>
       <tr>
         <td class="category">Properties &amp; Locations</td>
         <td class="non-title"><?php print render ($content['field_property_references']);?></td>
       </tr>
       <tr>
         <td class="category">People</td>
         <td class="non-title"><?php print render ($content['field_biography_references']);?></td>
       </tr>
       <tr>
        <td class="category">Photograph Category</td>
        <td class="non-title"><?php print render ($content['field_photograph_category']);?></td>
      </tr>
      <tr>
        <td class="category">Collection</td>
        <td class="non-title"><?php print render ($content['field_ahsphotograph_collection']);?></td>
      </tr>
      <tr>
        <td class="category">Photograph Date(s)</td>
        <td class="non-title"><?php print render ($content['field_photograph_date_s_']);?><?php print render ($content['field_date_specific_']);?></td>
      </tr>
      <tr>
        <td class="category">Original Available</td>
        <td class="non-title"><?php print render ($content['field_original_available']);?></td>
      </tr>
      <tr>
        <td class="category">Print Available</td>
        <td class="non-title"><?php print render ($content['field_print_available']);?></td>
      </tr>
      <tr>
        <td class="category">Negative Available</td>
        <td class="non-title"><?php print render ($content['field_negative_available']);?></td>
      </tr>
      <tr>
        <td class="category">Credit Line</td>
        <td class="non-title"><?php print render ($content['field_credit_line']);?></td>
      </tr>
       <tr>
        <td class="category">Tags</td>
        <td class="non-title"><?php print render ($content['field_photograph_tags']);?></td>
      </tr>
      <tr>
        <td><?php print render ($content['field_photo_object_id']);?><?php print render($content['field_photo_object_id']['1'][0]['value']); ?></td>
      <td><a href="http://history.arvadahistory.org/order-historic-image?edit[attributes][2]=<?php print render ($content['field_individual_id']);?>" target="_blank""><img src="http://history.arvadahistory.org/sites/default/files/imageorder_small.gif"></a><img src="http://history.arvadahistory.org/sites/default/files/feedback_small.gif" style="padding-left:50px"></td></tr>
    </tbody>
  </table>

--------------------------------------UPDATE-------------- As per the suggestion @rovr138 I have implemented the "tmpField" suggestion, which has worked out. I'll accept his answer tonight if there is nothing else that pops up.

1

A quick fix (since this is live), above table add,

<?php
  $tmpField = $content['field_individual_id'];
?>

Then the commented field, change it to:

    <td class="category">Individual ID</td>
    <td class="non-title"><?php print render ($tmpField); ?></td>
  • Thanks! That worked. Like I said in my above update, if I don't see anything else I'll just use yours as the example since it worked well. – Matthew Feb 20 '17 at 20:55

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.