show date & time for comments (except the same day) but still only show date in thread-overview
ok, i know it's a bit confusing and i'm starting to think i'm confusing myself more and more but i tried about thousands of possibilities now and i guess i'm losing track... :-P
so what i want is:
- _in_ discussions:
- for comments at the same day only show time (as usual)
- for older comments show date **and** time ('%d %B - %R')
- at discussion overview:
- for discussions where last comment was at the same day only show time (as usual)
- for discussions where last comment was earlier still only show date
i alredy tried many variatons of-date($Object->DateInserted, ('Y m d') == date($Now, ('Y m d')) and similar stuff in various files but nothing ever worked... is there a much easier solution which i just can't see or what am i doing wrong?
thanks for help in advance!
Best Answers
-
peregrine MVP
you could also take a look at the Unreadicon plugin
and modify it to your needs.
It will show you how to test for time difference and then you can reformat the time in a plugin or in the helper_functions.php file.
I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.
1
Answers
Search for timeago
Demo http://vanillaskins.com/response
There was an error rendering this rich post.
that gives me 4 results:
in the class.format-file it's quite easy to define, so it also should be in other files or what's my mistake in thoughts?
I dont understnd your question.
You want to change Posted:9.24 am to Posted:4 minutes ago ?
There was an error rendering this rich post.
no, not at all.
i want to change "posted april 24" to "posted april 24 - 13:22h" but only in discussions and only if the comment is not from the same day... so i changed defaultdateformat to '%d %B - %R'... but then there's the problem that in the thread-overview the format is changed too of course (and that doesn't look good). so i have to add something that changes that again, but only for the thread-overview.
the other version is that i only change the time format in the theme/view/discussion folder, but then i have to add something ("if-else" like mentioned in first posting) which because of an unknown reason doesn't work... so why does this not work:
you could also take a look at the Unreadicon plugin
and modify it to your needs.
It will show you how to test for time difference and then you can reformat the time in a plugin or in the helper_functions.php file.
I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.
ok, thanks a lot for the idea, i took a short look at the code of the plugin now and it seems to contain some new ideas, will have a closer look at it soon... :-) (now i have to get some sleep cause it's 3am here)
and i forgot to mention that, but i'm working in the helper-functions.php file most of the time...
Shouldnt be to difficult all that info is stored. Best of luck
There was an error rendering this rich post.
if it was that easy for me i wouldn't still be here... i'm cunfused... i think i got pretty close but i have one more question:
when
$indate = date($Sender->EventArguments['Comment']->DateInserted);
echoes: "2012-06-10 00:06:26"
why
$indate = date('Y m d', $Sender->EventArguments['Comment']->DateInserted);
echoes "1970 01 01"
?!
Epoch. You more than likely need to define another var, then parse it like $MyCustomDateTime
There was an error rendering this rich post.
finally i found a solution, i just used a little trick (i just cut the date-string)... so if anyone is interested, here's the code for the helper-functions.php file in the "discussion" folder:
<.span class="DateCreated">