Welcome to Alledia, the #1 Joomla Training Company

Would you like to learn Joomla? We're here to help you: Sign Up Today

  • Professionally-produced training videos and tutorials.
  • Guaranteed same-day answers to all your Joomla questions.
  • No Joomla experience needed. We've taught 1000s of Joomla students.

Home / Joomla Hacks / Joomla Websites Always Showing Today's Date 
Feb
02
2010

Joomla Websites Always Showing Today's Date

Written by Steve Burge   
Avatar

Here's a little fix we came across today while trying to find out why blog posts on this site had started always showing today's date. Even if a post was written in 2006 or 2007 it would show a 2010 date. Thanks to Anthony from Joomla Bamboo for helping me find the fix.

The problem is with overrides and you're likely to find them in this folder: / templates / your-template-name / html / com_content / article / default.php

The correct date line is going to look similar to this:

<?php echo JHTML::_('date', $this->article->created, JText::_('<div class="month">%b</div><div class="day">%d</div>%Y')); ?>

I've highlighted the two elements that need changing: JText::_( before the opening div and an extra ) at the end. The original line is likely to be found in templates that were created around Joomla 1.5.13 and earlier. It's more likely to look like this:

<?php echo JHTML::_('date', $this->article->created, '<div class="month">%b</div><div class="day">%d</div>%Y'); ?>

Because commercial and custom templates often don't get updated along with the Joomla core, errors like this can remain on a site.

And yes, this post was really written in 2010.

Free Weekly Joomla Tutorials

Your Comments (6)

0
bradon
February 03, 2010

good explanation..

0
Edvard Ananyan
February 04, 2010

Not sure if you have already fixed it, but for me it is still today for all your posts on your your http://www.alledia.com/blog/

steve
steve
February 04, 2010

Ooops - thanks Edvard

I need to the fix the blog section override file too.

0
Rodel
February 05, 2010

nice one!smilies/cool.gif

0
rodeldesign
February 05, 2010

Nice information. By the way, joomla bamboo rocks for many reasons. This is a new one!

0
TooN
March 10, 2010

Im not sure if this topic is related to it but i want to have the date next to the titles at the read more section. Just like showing here below....

can someone help me with this? will this be a core hack?

Thanks

Write comment

 
  smaller | bigger
 

busy