Show last update date - never changes

Rate this topic: Evaluations: 1, 1.00 on the average.Evaluations: 1, 1.00 on the average.Evaluations: 1, 1.00 on the average.Evaluations: 1, 1.00 on the average.Evaluations: 1, 1.00 on the average.Evaluations: 1, 1.00 on the average.1.00 out of 6 based on 1 vote(s)
GK User
Sun Aug 24, 2014 12:17 pm
Reply with quote
Report this post
Hi,
i see always this date time there: updated 11:00 PM CET, Feb 10, 2015

It never changes. Where do you take this time?

website: http://www.keinedomainjetzt.at/

thx
User avatar
Junior Boarder

GK User
Sun Aug 24, 2014 11:33 pm
Reply with quote
Report this post
Hello,

Do you have some posts which are pending?
User avatar
Administrator

GK User
Mon Aug 25, 2014 9:46 pm
Reply with quote
Report this post
Latest post is from today?
User avatar
Junior Boarder

GK User
Tue Aug 26, 2014 8:01 am
Reply with quote
Report this post
Please make sure that your file layouts/blocks/updates.php is the same as below:

Code: Select all
<?php

// No direct access.
defined('_JEXEC') or die;
jimport('joomla.html.html');

// Used helper function
if(!function_exists('gk_get_last_update')) {
   function gk_get_last_update($table, $column, $state) {
      $db = JFactory::getDBO();
      $date = JFactory::getDate("now");
      $now  = $date->toSql(true);
      $date_query = 'SELECT '.$column.' FROM #__'.$table.' WHERE '.$state.' = 1 AND '.$column.' <= '.$db->Quote($now).' ORDER BY '.$column.' DESC LIMIT 1;';   
      $db->setQuery($date_query);
      if($dates = $db->loadAssocList()) {
         foreach($dates as $date) {
            return strtotime($date[$column]);
         }
      }
   }
}

// Basic variables
$final_date = 0;
$new_date = 0;

// get joomla created dates
$final_date = gk_get_last_update('content', 'created', 'state');
// check if any modify date isn't later
$new_date = gk_get_last_update('content', 'modified', 'state');
if($new_date > $final_date) $final_date = $new_date;
// the same for K2 if exist
if(file_exists(JPATH_SITE.DS.'components'.DS.'com_k2'.DS.'helpers'.DS.'route.php')) {
   $new_date = gk_get_last_update('k2_items', 'created', 'published');
   if($new_date > $final_date) $final_date = $new_date;
   // return the final results
   $new_date = gk_get_last_update('k2_items', 'modified', 'published');
   if($new_date > $final_date) $final_date = $new_date;
}

echo JText::_('TPL_GK_LANG_UPDATE_DATE') . ' ' . JHtml::date($final_date, JText::_('TPL_GK_LANG_UPDATE_DATE_FORMAT'));

// EOF


If yes, please send me a back-end and FTP access to your website using the PM message.
User avatar
Administrator

GK User
Fri Jan 30, 2015 2:06 pm
Reply with quote
Report this post
Hi!

I tried it, it changed PDT to IST but still taking an old date, which 28th June 2014. Ideally it should be the current date.

Please help to resolve this issue. Website: www.getwebsite4u.com (This is a dummy link to create website for my client)

Regards.
Sidharth
User avatar
Fresh Boarder

GK User
Mon Feb 02, 2015 8:22 am
Reply with quote
Report this post
@sidmak - if you want to display the current date only, then please change the updates.php file to:

Code: Select all
<?php

// No direct access.
defined('_JEXEC') or die;
jimport('joomla.html.html');

echo JText::_('TPL_GK_LANG_UPDATE_DATE') . ' ' . JHtml::date(date(), JText::_('TPL_GK_LANG_UPDATE_DATE_FORMAT'));

// EOF
User avatar
Administrator


cron