Thans for nice hack.
I want make dynamic date but can't fully do it. So I make some as posts' experience.
This changes maked for rus lang, but I think that you can adaptive it for yourself
Some
global function from tvdev engine
Code: Select all
function getWord($number, $suffix) {
$keys = array(2, 0, 1, 1, 1, 2);
$mod = $number % 100;
$suffix_key = ($mod > 7 && $mod < 20) ? 2: $keys[min($mod % 10, 5)];
return $suffix[$suffix_key];
}
function get_elapsed_time_plural($time_start) {
$divider['years'] = (60 * 60 * 24 * 365);
$divider['months'] = (60 * 60 * 24 * 365 / 12);
$divider['weeks'] = (60 * 60 * 24 * 7);
$divider['days'] = (60 * 60 * 24);
$divider['hours'] = (60 * 60);
$divider['minutes'] = (60);
$langs['years'] = array("год", "года", "лет");
$langs['months'] = array("месяц", "месяца", "месяцев");
$langs['weeks'] = array("неделя", "недели", "недель");
$langs['days'] = array("день", "дня", "дней");
$langs['hours'] = array("час", "часа", "часов");
$langs['minutes'] = array("минуту", "минуты", "минут");
foreach ($divider as $unit => $div) {
${'elapsed_time_'.$unit} = floor(((time() - $time_start) / $div));
if (${'elapsed_time_'.$unit} >= 1)
break;
}
$elapsed_time = ${'elapsed_time_'.$unit} . ' ' . getWord(${'elapsed_time_'.$unit}, $langs[$unit]);
return $elapsed_time;
}
Then in listener replace for this
Code: Select all
//$topic_row ['TOPIC_AGE_DAYS'] = $this->user->lang('TOPICAGEDAYPOSTED', round((time() - $row['topic_time']) / 86400));
$topic_row ['TOPIC_AGE_DAYS'] = $this->user->lang( 'TOPICAGEDAYPOSTED', get_elapsed_time_plural( $row[ 'topic_time' ] ) );
In
common you must comment array and add this string
Code: Select all
'TOPICAGEDAYPOSTED' => 'стаж темы: %1$s',
And you can see something that
Bonus for you ;)
Code: Select all
span.topicageday {
padding-left: 2px;
vertical-align: super;
color: #4C5D77;
font-size: 10px;
-webkit-background-clip: text;
-moz-background-clip: text;
background-clip: text;
}