0

I'm extending the Tweme theme (a Bootstrap subtheme) and I want the "banner_image" field on the node page to be displayed in the header.

The page.tpl.html template from Tweme has the markup for the header, but this doesn't work because (I believe...) that template doesn't have access to the $content variable:

print render($content['field_review_nationality']); 

The node.tpl.html template does have access to $content, but the header isn't present in that template.

Where/how do I render my "banner_image" field?

1 Answer 1

1

You can find @var $node on page.tpl.php. you can display your field using this code.

<?php 
if(isset($node->field_review_nationality) && !empty($node->field_review_nationality['und'][0]['uri'])) {
   <img src="<?php print file_create_url($node->field_review_nationality['und'][0]['uri']); ?>"/>
} 
?>

If you have a style of the image then you can display using below code.

<?php print theme('image_style', array('path' => $node->field_review_nationality['und'][0]['uri'], 'style_name' => [STYLE NAME])); ?>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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