By Marc Bijl on
In my node.tpl.php I use this code (stripped for this topic), to display the node creation date:
<?php $submitted = 'Heerlen - ' . format_date($node->created, 'custom', 'd.m.Y') . ' - Marc Bijl'; ?>
<?php print '<div class="small">'. $submitted . '</div>'; ?>
And the date shows up correct, e.g. 04.01.2009
However, if I use exactly the same code in the body of a node (with php allowed), it shows up as 01.01.1970.
Any ideas?
Comments
$node is not define in
$node is not define in within the body of a node so $node->created would always be zero (which corresponds to 01.01.1970).
Workaround?
Hi Steve,
Thnx for the quick reply ;)
Do you know if there's a workaround to get the nodes date created from within the body?
Cheers,
Marc
___________________
discover new oceans
lose sight of the shore
Sure, but it only works when
Sure, but it only works when viewing a single node (i.e. at the path node/{nid})
Also see: http://drupal.org/project/reptag
Thnx!
Thanks mate,
I'll try it tonight!
___________________
discover new oceans
lose sight of the shore
Works like a charm!
You just made my day!
Don't have a clue what the code means/does,
but it works like a charm. Neat...
Many thanks,
Marc
___________________
discover new oceans
lose sight of the shore