Simple Machines Community Forum

Customizing SMF => SMF Coding Discussion => Aiheen aloitti: dopeitspaul - elokuu 10, 2014, 01:46:59 AP

Otsikko: Need help adjusting code for time
Kirjoitti: dopeitspaul - elokuu 10, 2014, 01:46:59 AP
Hey everyone I was working on the Last Post column displayed on the board index.

I was wondering how I can remove the bold shown on "today"and remove the word "at"
I want it to look like the other red box I highlighted.



I tried looking for it at the board index template but couldn't find it. Any help? Thanks
Otsikko: Re: Need help adjusting code for time
Kirjoitti: kat - elokuu 10, 2014, 06:25:57 AP
No need to butcher any code. :)

Just change Admin>Features and options>Layout>Enable shorthand date display
Otsikko: Re: Need help adjusting code for time
Kirjoitti: Illori - elokuu 10, 2014, 06:33:02 AP
LainaaThis will show "Today" or "Yesterday" instead of the date.

Examples:

Disabled
    October 3, 2009 at 12:59:18 am
Only Today
    Today at 12:59:18 am
Today & Yesterday
    Yesterday at 09:36:55 pm

i dont think that is what the op wants.
Otsikko: Re: Need help adjusting code for time
Kirjoitti: Arantor - elokuu 10, 2014, 08:12:07 AP
Trouble is, the routine is used everywhere and has already been modified if it's offering a day name instead of a date.
Otsikko: Re: Need help adjusting code for time
Kirjoitti: dopeitspaul - elokuu 10, 2014, 12:44:55 IP
I'm trying to make it look like my recent post block. This is a custom php that was made thanks to simple portal support




Now I'm just trying to do the same thing for the board index.
Otsikko: Re: Need help adjusting code for time
Kirjoitti: Arantor - elokuu 10, 2014, 12:47:14 IP
Interesting. Since the standard one uses SMF's standard formatting routine and for some reason the block *doesn't*. SMF comes with a function called timeformat() that does all time formatting, and is responsible for adding the bold in.

That block deliberately ignores the routine which uses this in index.english.php:
$txt['today'] = '<strong>Today</strong> at ';
$txt['yesterday'] = '<strong>Yesterday</strong> at ';
Otsikko: Re: Need help adjusting code for time
Kirjoitti: dopeitspaul - elokuu 10, 2014, 01:04:37 IP
Lainaus käyttäjältä: ‽ - elokuu 10, 2014, 12:47:14 IP
Interesting. Since the standard one uses SMF's standard formatting routine and for some reason the block *doesn't*. SMF comes with a function called timeformat() that does all time formatting, and is responsible for adding the bold in.

That block deliberately ignores the routine which uses this in index.english.php:
$txt['today'] = '<strong>Today</strong> at ';
$txt['yesterday'] = '<strong>Yesterday</strong> at ';


Worked Perfectly thanks!

One more thing I just realized is that on the board index, my name isn't red compared to the one on the right block. Is there a way to turn on the colors for Admins and Moderators, etc?
Otsikko: Re: Need help adjusting code for time
Kirjoitti: Arantor - elokuu 10, 2014, 01:26:28 IP
Not without a mod, and yet again the block is doing something that SMF itself doesn't do.
Otsikko: Re: Need help adjusting code for time
Kirjoitti: dopeitspaul - elokuu 10, 2014, 03:47:51 IP
Thanks, does a mod for that exist already? If not, you have the link?

Otherwise, I'll post it on the Mod Request section