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.
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! (http://www.tinyportal.net/index.php/topic,581)
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! (http://www.tinyportal.net/index.php/topic,581)
Hmmm.... have you looked at my signature?
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! (http://www.tinyportal.net/index.php/topic,581)
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
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.
Thanks... everything works fine. One point to clarify: in my version the code is located in Sources/TPortal.php (line 700 more or less)
Ah yes, that would be before it was moved to the modules. :) TP 1.x beta