1

I created an Image Field for the Basic Page Content Type.

I want to control the output of this image to use as a banner with a caption on top. Is there a function to render out a field specific to the page,

such as <?php print render($page['my_image_field']); ?>.

I wan't to style this separately from the body content.

1

You can do this within a tpl file specific to your content type. In this case it sounds like it'd be node--page.tpl.php

All the drupal 7 template naming suggestions are available at - https://drupal.org/node/1089656

Just make sure you have a regular node.tpl.php file in your theme before creating the new one.

From there this thread tells you how to go about printing your field elsewhere (specific to drupal 7)- https://drupal.org/node/1059636

Specific to your question:

<?php
hide($content['field_my_image_field']);
print render($content);
?>

then wherever you want your image to appear at use

<?php
print render($content['field_my_image_field']); 
?>

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.