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); ?> | |
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
<?php if(isset($node->field_NAME[0]['value']) && $node->field_NAME[0]['value'] != ''): ?> | |
<div class="name"> | |
<?php print $node->field_NAME[0]['value'] ?> | |
<!-- OR --> | |
<?php print content_format('field_NAME', $field_NAME[0]); ?> | |
</div> | |
<?php endif; ?> |
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
<img src="/<?php print $node->field_self_photo[0]['filepath'] ;?>" alt="<?php print $node->field_self_photo[0]['data']['alt'] ;?>" /> |
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
<?php if(isset($node->field_NAME[0]['value']) && $node->field_NAME[0]['value'] != ''): ?> | |
<div class="field-field-NAME"><div class="field-items"> | |
<?php foreach ($field_NAME as $i => $NAME) { ?> | |
<?php if ($i != 0):?> | <?php endif; ?> | |
<?php print content_format('field_NAME', $NAME); ?> | |
<?php } ?> | |
</div></div> | |
<?php endif; ?> |
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
<?php // display all | |
dsm(get_defined_vars()); | |
?> | |
<?php //http://drupal.org/node/308732 | |
print '<pre>'; | |
var_dump(get_defined_vars()); | |
print '</pre>'; | |
?> |
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
<?php | |
for ($i = $view->total_rows + 1; $i <= 4; $i++) { | |
print '<div class="events ' . $i . '">'; | |
print ' <h3>No Events</h3>'; | |
print '</div>'; | |
} | |
?> |
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
<?php | |
global $user; | |
$has_role = array_intersect(array('administrator', 'Other admin', 'Client admin'), array_values($user->roles)); | |
if (empty($has_role) ? FALSE : TRUE) { | |
// This user has any one of the three roles | |
} | |
?> |
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
<?php // Add to template.php | |
function [theme name]_date_all_day_label() { | |
return ''; | |
} |
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
<?php if ($node->type == 'content_type_name'): ?> | |
Do something... | |
<?php endif; ?> |
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
<?php | |
/** | |
* Remove homepage field in comments in template.php | |
* http://www.digett.com/blog/05/26/2011/how-theme-comment-form-drupal-7 | |
*/ | |
function THEMENAME_form_comment_form_alter(&$form, &$form_state) { | |
$form['author']['homepage']['#access'] = FALSE; | |
} | |
?> |