By Christian Hostettler on Friday, 10 May 2019
Posted in Technical Issues
Likes 0
Views 596
Votes 0
Hello Stackideas!
We customize the output of /forums/item.php. In addition to the time of posting

<? Php echo ED :: date () -> toLapsed ($ post-> lastupdate);?>
, We'd like to add the time of the last answer, if there is an answer. How can we call this?
Best regards
Christian
You can try this :


ED::date($post->lastupdate)->display("Y-m-d H-i-s");
·
Friday, 10 May 2019 18:02
·
0 Likes
·
0 Votes
·
0 Comments
·
Grandios, Arlex, thank you for the super fast support!
Now I have noticed that my concept was not quite right: we would like to display 2 dates: the time of the post by the author and the time of the most recent answer, if there is an answer.
In both cases the output "3 days ago", "a few minutes ago" etc. would be ideal. Could you help me with this, or what files do I have to study to understand the code?
Best regards
Christian
·
Friday, 10 May 2019 18:12
·
0 Likes
·
0 Votes
·
0 Comments
·
Basically you can just var_dump($post);exit; this $post variable on /forums/item.php file, so you can see what property you can call from this $post object.

For example :

$post->created -> it will return you that thread creation datetime.

$post->lastupdate -> it will return you the last reply datetime.

So you probably can pass inside this date library so it will return you this similar result "3 days ago", "a few minutes ago".


<div class="ed-forum-item__meta"><?php echo ED::date()->toLapsed($post->created) . ' , ' . ED::date()->toLapsed($post->lastupdate); ?></div>
·
Friday, 10 May 2019 18:33
·
0 Likes
·
0 Votes
·
0 Comments
·
Thank you, Arlex
That helps a lot, we are progressing so well!
Best regards
Christian
·
Friday, 10 May 2019 18:42
·
0 Likes
·
0 Votes
·
0 Comments
·
Hi there,

You are most welcome. Glad to hear that your issue has been resolved now.

Just for your information, I have locked and marked this thread as resolved to avoid confusions in the future. Please start a new thread if you have any other issue in the future so it will be easier for us to manage your inquiries.

Thanks for understanding.
·
Friday, 10 May 2019 18:49
·
0 Likes
·
0 Votes
·
0 Comments
·
View Full Post