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 // http://drupal.org/node/224171 | |
$nodeterms = array(); | |
foreach($node->taxonomy as $nodeterm) { | |
$nodeterms[] = $nodeterm->name; | |
} if (in_array('TERM-NAME', $nodeterms)): ?> | |
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 // http://drupal.org/node/43512 | |
print date('j F Y - g:ia', $node->changed); | |
?> | |
<?php // if checked in content-type edit | |
if ($submitted) { | |
echo 'This page was last modified on ' . date( "F j, Y",$node->changed); | |
}; | |
?> |
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 | |
/* | |
* Drupal 6 - zen theme | |
*/ | |
print t('@date', array( | |
'@date' => format_date($node->created, 'custom', 'l, F j, Y'), | |
'!username' => theme('username', $node) | |
)); | |
?> |
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
textarea { | |
-moz-resize: vertical; | |
-webkit-resize: vertical; | |
resize: vertical; | |
} |
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 | |
$match=strtolower($node->title); print $node_field[0]['value'] = str_replace(' ', '-', $match); | |
?> |
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 //set var to identify content type | |
$node_type = $row->_field_data['nid']['entity']->type; | |
?> | |
<?php //check for content types | |
if ($node_type == 'CT_NAME' || $node_type == 'CT_NAME_OTHER'): | |
?> | |
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 | |
/* | |
* http://robotlikehuman.com/web/how-print-view-drupal-7-and-drupal-6 | |
* Replace VIEW_NAME with the exact machine_name of the View. | |
*/ | |
$viewName = 'VIEW_NAME'; | |
print views_embed_view($viewName); | |
?> |
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
// default field output | |
<?php print render($content['field_EXAMPLE']); ?> | |
<?php print render($content['body']); ?> | |
// striped output only | |
<?php print render($content['field_EXAMPLE']['und'][0]['value']); ?> | |
<?php print render($content['field_EXAMPLE']['und'][0]['url']); ?> | |
<?php print render($content['field_EXAMPLE']['und'][0]['email']); ?> | |
// make sure field isn't empty |
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
/** | |
* First register the override in your template.php file (my example uses a zen subtheme) | |
* http://drupal.org/node/147502#comment-1654954 | |
*/ | |
<?php | |
/** | |
* Implementation of zen HOOK_theme(). | |
*/ | |
function YOUR-THEME-NAME_theme(&$existing, $type, $theme, $path) { |
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 | |
/** | |
* Change the output for submmited by in comments | |
*/ | |
function rrm_comment_submitted($comment) { | |
return t('Posted by !username at @time', array( | |
'!username' => theme('username', $comment), | |
'@date' => format_date($comment->timestamp, 'custom', 'd M Y'), | |
'@time' => format_date($comment->timestamp, 'custom', 'g:i a') | |
)); |