Formatting Date and Time in Drupal
Snippet to change the node created on date for use in story nodes:
In node-story.tpl.php or other node tpl:
<?php print format_date($node->created, 'custom', 'F jS, Y'); ?>Prints:
March 25th, 2009
Check out php.net for complete list!
Making a separator in your page title to not show up on the front page in Drupal
By divider I mean the '|' that I currently have on my site's titlebar. Now, this is all fine, to have $site_name and $title appear with a | separator, but It kind of looks weird on the front page when there is no page title.
It's pretty easy to just have it called differently when you are using page-front.tpl.php, but my site doesn't use a separate template file for the front page, so why should I have to make one for just this?
I've been using an if else statement to check $if_front and then display the separator, title and site name or else to show just the site name. Alternatively you could just check if there is a title and do it that way.
<title>
<?php
if ($is_front) {
print $site_name;
} else {
print $title . t(' | ') . $site_name;
}
?>
</title>
This seems to work well for me, thoughts?