Last active
February 17, 2021 03:51
-
-
Save frankyonnetti/5944707 to your computer and use it in GitHub Desktop.
Drupal 7 - print field #drupal #d7
This file contains hidden or 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
// better | |
<?php $services = field_get_items('node', $node, 'field_services'); ?> | |
<?php if($services): ?> | |
<?php print render($content['field_services']); ?> | |
<?php endif; ?> | |
// other | |
<?php $city = field_view_field('node', $node, 'field_city', array('label' => 'hidden')); print render($city); ?> | |
// old | |
<?php if(isset($node->field_NAME['und'][0]) && $node->field_NAME['und'][0] != ''): ?> | |
<div class="name"><?php print render($content['field_NAME'][0]); ?></div> | |
<?php endif; ?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment