Created
October 21, 2016 16:48
-
-
Save occupant/c9df13f464d49ae44cba0a6675d66365 to your computer and use it in GitHub Desktop.
Print a node field in a page.tpl.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$background_image = field_view_field('node', $node, 'field_image_divider_background', array('label'=>'hidden','type' => 'image_url', )); | |
// type refers to the field formatter - image_url from the image_url_formatter madule in this case | |
// see - https://api.drupal.org/api/drupal/modules%21field%21field.module/function/field_view_field/7.x | |
?> | |
<?php if (!empty($background_image)): ?> | |
<div style="background-image:url(<?php print render($background_image); ?>)" class="imagebreak imagebreak--screened imagebreak--ctas non-clf" > | |
etc... | |
</div> | |
<?php endif; ?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment