3

I added the following code to my node.topl.php but nothing is displaying on my site. What am I missing?

<?php
if ($submitted) { 
  echo 'This page was last modified on ' . date( "F j, Y",$node->changed);  
} ; 
?>
1
  • 1
    I recommend using drupal's format_date() function instead of date().
    – rooby
    Apr 2, 2015 at 5:13

2 Answers 2

0

Perhaps that content type has "submitted by" information hidden.

Try just:

print 'This page was last modified on ' . date('F j, Y', $node->changed);  

And clear cache at Admin > Config > Performance

5
  • Thank you David. I've cindluded the following code just before the closing header tag in my node.tpl.php file I've also cleared the cache but am not seeing the last modified line on my site :( <?php print 'This page was last modified on ' . date('F j, Y', $node->changed);?>
    – kine456
    Feb 10, 2013 at 23:10
  • Can you include your whole node.tpl.php file in your question? Feb 10, 2013 at 23:13
  • Ooops. Including the same line after the article closing tag makes the line display. However, how would I go about displaying this in the footer of each page instead? Including the homepage. At the moment the last updated line is not displaying on the homepage ...
    – kine456
    Feb 10, 2013 at 23:14
  • Sorry, it is now displaying, but how do I make it display in the footer instead?
    – kine456
    Feb 10, 2013 at 23:32
  • Is there a way for me to "Blockify" it?
    – kine456
    Feb 10, 2013 at 23:32
0

I have a slightly different approach on this. Edit the page.tpl.php and add this:

<?php if (isset($node->changed)): ?>
  <div class="page-update">
    <time datetime="<?php echo date('Y-m-d', $node->changed); ?>">Page Updated: <?php echo date('m-d-Y', $node->changed); ?></time>
  </div>
<?php endif; ?>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.