TP-Docs
HTML5 Icon HTML5 Icon HTML5 Icon
TP on Social Media

Recent

Welcome to TinyPortal. Please login or sign up.

Members
  • Total Members: 3,973
  • Latest: NonStop
Stats
  • Total Posts: 196,224
  • Total Topics: 21,352
  • Online today: 633
  • Online ever: 8,223 (February 19, 2025, 04:35:35 AM)
Users Online
  • Users: 1
  • Guests: 175
  • Total: 176
  • @rjen

How to change time format in shoutbox only

Started by Przemek84, October 07, 2008, 07:21:56 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Przemek84

Hi,

I need to change the time format in shoutbox, but not in other places. I've read this topic: http://www.tinyportal.net/index.php/topic,155.0.html but it seems it is a bit outdated because the code is different now. What is more, the solution changes the time format everywhere.

Does anyone have an idea how to do it?

Any hints are welcomed.

IchBin

Yes, considering that was 3 years ago. I hope the code has changed. :D I can only assume that you are asking about TP 1.0 beta 1 and also that you are using the simple shoutbox and not the advanced? Please provide us with the details that the posting guidelines ask for. Thanks!

Przemek84

Quote from: IchBinâ,,¢ on October 07, 2008, 07:36:39 PM
Yes, considering that was 3 years ago. I hope the code has changed. :D I can only assume that you are asking about TP 1.0 beta 1 and also that you are using the simple shoutbox and not the advanced? Please provide us with the details that the posting guidelines ask for. Thanks!

Hmmm.... have you looked at my signature?

IchBin

Quote from: Przemek84 on October 07, 2008, 07:39:32 PM
Quote from: IchBinâ,,¢ on October 07, 2008, 07:36:39 PM
Yes, considering that was 3 years ago. I hope the code has changed. :D I can only assume that you are asking about TP 1.0 beta 1 and also that you are using the simple shoutbox and not the advanced? Please provide us with the details that the posting guidelines ask for. Thanks!

Hmmm.... have you looked at my signature?
As a matter of fact, no I haven't. lol Thanks for pointing that out. I'll go take a look at the code for you. :D

IchBin

#4
Sorry, got distracted at work. HOW DARE THEY! ;)

// don't fetch more than a hundred - save the poor server! :D
if($limit>100) $limit=100;
$request = db_query("SELECT * FROM {$tp_prefix}shoutbox WHERE value7=0 ORDER BY value2 DESC LIMIT $limit", __FILE__, __LINE__);
if (mysql_num_rows($request) > 0)
{
$nshouts= $txt['tp-last'].' '.$limit.' '.$txt['tp-shouts'].'<hr />';

while($row = mysql_fetch_assoc($request))
{
$nshouts .='<div style="margin: 4px;"><div style="border: dotted 1px; padding: 2px 4px 2px 4px;" class="windowbg2"><b>'.$row['value3'].'</b></div><div style="padding: 2px;"> '.timeformat($row['value2']).'</div><div style="padding: 4px;">';
$myshout='';
$myshout=$row['value1'];
$nshouts .= doUBBC(censorText($myshout));
$nshouts .= '</div></div>';
}
$context['TPortal']['shoutbox']=$nshouts;
mysql_free_result($request);


You can see that it uses SMF's timeformate() function. You can change this to use the php date() function and then customize it to the layout of date-month-year that you want.
http://www.php.net/date

So if you wanted the date to appear in this formate mm-dd-yy you would replace timeformate($row['value2']) with this -   date('d-m-y', $row['value2'])

Forgot to say, this is in the TPshout.php file in the Sources folder.

Przemek84

Thanks... everything works fine. One point to clarify: in my version the code is located in Sources/TPortal.php (line 700 more or less)

IchBin

Ah yes, that would be before it was moved to the modules. :) TP 1.x beta

This website is proudly hosted on Crocweb Cloud Website Hosting.