News:

Wondering if this will always be free?  See why free is better.

Main Menu

Can I change the color of the "today" and "Yesterday"?

Started by tennis4you, September 15, 2007, 05:54:32 PM

Previous topic - Next topic

tennis4you

Is it possible for me to be able to change the color of the text that says "Today" and "Yesterday" on the forum's index?

codenaught

Well this will do it for all occurrences of Today and Yesterday and also does it to the word "at."

Open Sources/Subs.php:

Find (First occurrence):

return $txt['smf10'] . timeformat($logTime, $today_fmt);


Change to:

return '<span class="today"> ' . $txt['smf10'] . '</span>' . timeformat($logTime, $today_fmt);

Find (second occurrence):

return $txt['smf10b'] . timeformat($logTime, $today_fmt);


Change to:

return '<span class="yesterday"> ' . $txt['smf10'] . '</span>' . timeformat($logTime, $today_fmt);

Then in Themes/<theme_name>/style.css you can add:

.today
{
color: #CCCCCC;
}
.yesterday
{
color: #F7F7F7;
}


Changing the color attributes to what you want. If you don't want it to also color the word "at" I can help you out more on this.

How do I modify files?
Dev Consultant
Former SMF Doc Coordinator

tennis4you

That worked well.  If taking out the color on the "at" is easy then I am game for it.  Is your code right above though?  The Yesterday now says "today" just a different color...

codenaught

Sorry, instead of:

return '<span class="yesterday"> ' . $txt['smf10'] . '</span>' . timeformat($logTime, $today_fmt);

Make it:

return '<span class="yesterday"> ' . $txt['smf10b'] . '</span>' . timeformat($logTime, $today_fmt);

To make it not color the "at" open Themes/default/languages/index.english.php:

Find:

$txt['smf10'] = '<b>Today</b> at ';
$txt['smf10b'] = '<b>Yesterday</b> at ';


Change to:

$txt['smf10'] = '<b>Today</b>';
$txt['smf10b'] = '<b>Yesterday</b>';
$txt['smf10at'] = 'at';


Then use:

return '<span class="today"> ' . $txt['smf10'] . '</span> ' . $txt['smf10at'] . ' ' . timeformat($logTime, $today_fmt);

And:

return '<span class="yesterday"> ' . $txt['smf10b'] . '</span> ' . $txt['smf10at']  . ' ' . timeformat($logTime, $today_fmt);
Dev Consultant
Former SMF Doc Coordinator

Advertisement: