Uutiset:

SMF 2.1.4 has been released! Take it for a spin! Read more.

Main Menu
Advertisement:

Time Stamp with "Today"

Aloittaja Freiluft, syyskuu 04, 2006, 01:12:04 IP

« edellinen - seuraava »

Freiluft

If one chooses to enable the "Today" feature in Features and Options>Layout and Options, in posts you end up with:

on: Today at 06:44 PM    on: Yesterday at 08:44 AM

Figuring out how to get another "if" statement into the relevant line of code goes way beyond my very rudimentary knowledge of php, but the "on" shouldn't be used and it's even worse nonsense in other languages with "today" and "yesterday". One also doesn't need the colon in any language. Also any way to get the PM/AM in lowercase or small caps?

bloc

The use of "on" is a compromise since its correct when not using "today"..it could perhaps be better. The colon just signifies a quoted piece of data is shown, whats wrong with that?

AM/PM I think is usually done in capitals isn't it?...not sure though, since my own language, norwegian, do not use those at all, only the 24 hour format. I will let others comment that lol. :)

Freiluft

It's a quoted piece of data to you, because in code it "quotes" a variable. But in terms of a simple language statement, it doesn't quote anything — in English or any other language. Where, for instance, do you see, "He was born on: 16 September 1974?"

AM/PM or am/pm is just a matter of preference. I happen to prefer am/pm and am asking if it were possible to have that displayed. Our forum is quite international, but there are many Americans, so the site owner has chosen to use the am/pm display. It's really a very small matter.

For "on: Today", I am asking how one would write a statement so that if the "Today" feature is checked, then it would display, "Today at 6:50 pm".

The beauty of SMF is that it is infinitely customisable. But I don't know how to alter this line of code accordingly, which is why I'm asking here.


bloc

No, thats correct..you don't say "born on: 16.september". But here it says "Reply #2 on: Thursday 14.october". It does not say "Reply number 2 were made on Thursday". While I am not directly involved in translation and strings of SMF, I assume its shorthand writing and probably the reason the colon is used.

The colon is used in Display.template.php and you can check the "today" settings and set it accordinly.Find the following:
// If this is the first post, (#0) just say when it was posted - otherwise give the reply #.
echo '
<div class="smalltext">« <b>', !empty($message['counter']) ? $txt[146] . ' #' . $message['counter'] : '', ' ', $txt[30], ':</b> ', $message['time'], ' »</div></td>
<td align="', !$context['right_to_left'] ? 'right' : 'left', '" valign="bottom" height="20" style="font-size: smaller;">';

and replace with:
// If this is the first post, (#0) just say when it was posted - otherwise give the reply #.
echo '
<div class="smalltext">« <b>', !empty($message['counter']) ? $txt[146] . ' #' . $message['counter'] : '', ' ', $modSettings['todayMod'] >= 1 ? 'at ' : $txt[30].':' , '</b> ', $message['time'], ' »</div></td>
<td align="', !$context['right_to_left'] ? 'right' : 'left', '" valign="bottom" height="20" style="font-size: smaller;">';





Freiluft


Advertisement: