Description: Replaces today and yesterday's dates with coloured text. [red] Today at: 09:30[/red] or [green] Yesterday at: 12:30[/green]
Status: Release (Installed on this site)
Version: See code below.
- Code: Select all
(Based on code from CyberAlien)
# START: Today, Yesterday and Tomorrow Mod By Michaelo [Version 1.4.0]
/**************************************************************************/
OPEN
includes/functions.php
FIND
?>
BEFORE IT ADD
function create_date_ex($format, $gmepoch, $tz)
{
global $lang;
static $today, $yesterday, $time;
if(empty($today))
{
$today = array();
$yesterday = array();
$time = time();
}
$str = create_date($format, $gmepoch, $tz);
if(empty($today[$format]))
{
$today[$format] = create_date($format, $time, $tz);
$yesterday[$format] = create_date($format, $time - 86400, $tz);
}
if($str === $today[$format])
{
return '<span class="date-today">' . $lang['Today'] . '</span>';
}
elseif($str === $yesterday[$format])
{
return '<span class="date-yesterday">' . $lang['Yesterday'] . '</span>';
}
return $str;
}
function create_date2($format, $gmepoch, $tz)
{
$str = create_date_ex('d M Y', $gmepoch, $tz);
$str .= ' ' . create_date('h:i a', $gmepoch, $tz);
return $str;
}
OPEN
includes/functions_categories_hierarchy.php
FIND (~1580)
$last_post_time = create_date($board_config['default_dateformat'], $approve_row['post_time'], $board_config['board_timezone']);
AND REPLACE WITH
$last_post_time = create_date2($board_config['default_dateformat'], $approve_row['post_time'], $board_config['board_timezone']);
OPEN
viewtopic.php
FIND (2 occurances)
$post_date = create_date($board_config['default_dateformat'], $row['post_time'], $board_config['board_timezone']);
AND REPLACE WITH
$post_date = create_date2($board_config['default_dateformat'], $row['post_time'], $board_config['board_timezone']);
FIND
$l_edited_by = '<br /><br />' . sprintf($l_edit_time_total, $poster, create_date($board_config['default_dateformat'], $postrow[$i]['post_edit_time'], $board_config['board_timezone']), $postrow[$i]['post_edit_count']);
AND REPLACE WITH
$l_edited_by = '<br /><br />' . sprintf($l_edit_time_total, $poster, create_date2($board_config['default_dateformat'], $postrow[$i]['post_edit_time'], $board_config['board_timezone']), $postrow[$i]['post_edit_count']);
/**************************************************************************/
FINISHED: Today, Yesterday and Tomorrow Mod By Michaelo [Version 1.4.0]
Additional Code:
- Code: Select all
Add these lines to all your template.css file.
.date-future, .last-post b { color: #F8BA00; font-size: 11px; font-weight: normal; }
.date-today, .last-post b { color: #BA1A1A; font-size: 11px; font-weight: normal; }
.date-yesterday, .last-post em { color: #189E35; font-size: 11px; font-weight: normal; font-style: ; }
Mike