miniBB ® 

miniBB

®
Support Forums
  
 | Start | Register | Search | Statistics | File Bank | Manual |
Custom Tutorials and Modifications miniBB Support Forums / Custom Tutorials and Modifications /  
 

Today/Yesterday instead of the date

 
 
Page  Page 1 of 2:  1  2  Next »

Author tom322
Active Member
#1 | Posted: 6 May 2006 23:24 
An idea - (or maybe it can be done now?).

Is it possible to insert the word "Today" or "Yesterday" instead of the date?

The date depends on the server, of course, but let's assume it's the server's date that would need to be converted to "Today/Yesterday". I would be good to put it in the Latest Discussions so that it's easier to keep track.

Author Ivan
Advanced Member
#2 | Posted: 7 May 2006 09:02 
And what if the recent post is from before-yesterday? :)

Author marsbar
Associated Member
#3 | Posted: 7 May 2006 09:23 
Ivan wrote: And what if the recent post is from before-yesterday? :)

I presume the post from the day before yesterday would just bear the default date-time stamp. (I personally prefer to see the existing date-time stamp convention retained.)

Author Ivan
Advanced Member
#4 | Posted: 7 May 2006 10:46 
Me, too! :) The date is a date. I don't keep count when our members want to write and don't force them to, this will be a kind of terror :)

Well, if someone has some specific taste for that, it is, I suppose, possible to connect to the date place in the templates some small addon like:

<?php
set variable [$date2]
set area [$date]

if $date2 is {
$date2(today) $date2=={$l_today};
else if $date2(today-1) $date2=={$l_yesterday};
else if $date2(today<(today-1)) $date2==[GET_DATE];
return;
}
?>

/* Language variables for Today/Yesterday addon */
$l_today='Today'
$l_yesterday='Yesterday'
/* --Language variables for Today/Yesterday addon */

:)))

Team, of course, may find some small errors in the above script :) but this is a kind a conceptual one :)))

Author tom322
Active Member
#5 | Posted: 7 May 2006 18:45 
I presume the post from the day before yesterday would just bear the default date-time stamp.
Yes, that's exactly what I meant;). It just seems to me many users just don't know what date they live in [some of them may also confuse the year! ;), so I think it will be easier to them to recognize "today/yesterday".

Thanks for the code -- I'll wait until Team may confirm it's working and will use it :). I'm not sure in which templates to put it though ("place in the templates some small addon like").

Author Ivan
Advanced Member
#6 | Posted: 7 May 2006 19:39 
GOD, NO!!! It's not a real code :) I'm not a programmer (by now) :) As a syntax it's rubbish, but some similar scheme/logic could be used, I think. Of course, there must be some language variables as well - to appear in the table instead the recent dates. For a real code wait Team :)

However, I, too, prefer the dates, this is more real and concrete. Anyway, yours is a variant, too... as a modification.

Author tom322
Active Member
#7 | Posted: 7 May 2006 20:20 
OK, at least I'm not the only one who's not a programmer by now..;). So this is an algoritm and makes sense to me. If it's easy to implement - that's another question..:}

Author Ivan
Advanced Member
#8 | Posted: 7 May 2006 20:40 
May be there's simpler way, too. Just to set that the date = date2 and to determine date2 with something similar. Such way you 1) won't rework templates, and 2) could revert the previous state only deleting the right part of the equation at the place it's set.

Anyway, let's see what Team will say.

Author Paul
Lead Developer 
#9 | Posted: 8 May 2006 07:49 
Don't know guys what to complicate here - miniBB has internal function parseTopic() which you can program to handle this task. Example for putting in bb_plugins.php:

/* displaying "Today/Yesterday" for available dates */
function parseTopic(){

if(isset($GLOBALS['timeDiff'])) $timeDiff=$GLOBALS['timeDiff']; else $timeDiff=0;

if($timeDiff==0) $gdate=$GLOBALS['pVals'][$GLOBALS['topic']][2];
else $gdate=date('Y-m-d H:i:s', strtotime($GLOBALS['pVals']
[$GLOBALS['topic']][2]) + $timeDiff);

$td=explode(' ', $gdate); $topicday=$td[0]; $ttime=$td[1];

$today=date('Y-m-d', time()+$timeDiff);

$yesterday=date('Y-m-d', time()-86400+$timeDiff);

$wp='';
if($today==$topicday) $wp='Today';
elseif($yesterday==$topicday) $wp='Yesterday';

if($wp!='') $GLOBALS['lastPostDate']=$wp.' '.$ttime;

}

/* --displaying "Today/Yesterday" for available dates */

Author Ivan
Advanced Member
#10 | Posted: 8 May 2006 08:44 
The complicated is that I (and he, obviously) didn't learn enough PHP, and the programming is not exactly a fiction literature, however (where I'm slightly better) :)))

Thanks! :)

I suppose one can instead the words Today and Yesterday set two language variables, else they will appear as text of Beatles: Yesterdayyyyyy...

tom322, your problem's over!

Author Paul
Lead Developer 
#11 | Posted: 8 May 2006 09:14 
Language depends on the customer already :-)

If you set this in language pack:

$l_today='Today';
$l_yesterday='Yesterday';

then in my code, instead of $wp='Today'; it should be $wp=$GLOBALS['l_today']; and instead of $wp='Yesterday'; it should be $wp=$GLOBALS['l_yesterday']
;

Author tom322
Active Member
#12 | Posted: 8 May 2006 15:10 
Thanks :)

Author tom322
Active Member
#13 | Posted: 23 May 2006 23:01 
One more question for those who know PHP :):

Is it possible to format text directly in lang.php file? I'd like the "Today/Yesterday" words to be bold. Can I put something like that:

[b]$l_today='Today'; [/b]
[b]$l_yesterday='Yesterday'; [/b]

(I know I can't - but can I do it using Php expressions somehow)?


IF not, how can I change the above code so that the 'Today' and 'Yesterday' are in bold (while other days should remain formatted as they are by default)?

Thanks,

tom

Author marsbar
Associated Member
#14 | Posted: 24 May 2006 02:44 
Try:
$l_today='<strong>Today</strong>'; $l_yesterday='<strong>Yesterday</strong>';

Author tom322
Active Member
#15 | Posted: 24 May 2006 03:12 
marsbar
Wow, it worked perfectly, thanks!

tom

Page  Page 1 of 2:  1  2  Next » 
Custom Tutorials and Modifications miniBB Support Forums / Custom Tutorials and Modifications /
 Today/Yesterday instead of the date
 Share Topic's Link

Your Reply Click this icon to move up to the quoted message


  ?
Post as a Guest, leaving the Password field blank. You could also enter a Guest name, if it's not taken by a member yet. Sign-in and post at once, or just sign-in, bypassing the message's text.


Before posting, make sure your message is compliant with forum rules; otherwise it could be locked or removed with no explanation.

 

 
 
miniBB Support Forums Powered by Forum Software miniBB ® Home  Features  Requirements  Demo  Download  Showcase  Gallery of Arts
Compiler  Premium Extensions  Premium Support  License  Contact Us
Get the Captcha add-on: protect your miniBB-forums from the automated spam and flood.


  ⇑