I’m working on some kind of blog/archive and I was wondering if there is a way to display a »new« and »edited« div which disappears after a certain time.
I guess there is one but I have no clue how to do so
I’m eager to hear your solutions
kind regards in advance
J
I don’t know how familiar you are with PHP. But displaying a “new” badge of some sorts is pretty straight forward.
You will need a date field on the article that gets updated when saving/editing and a defined time span when articles are still considered “new”.
In the articles template you will just need to check wether today is after the date field plus the time span.
If you need help with the actual code, just reply.
Actually it seems quite logical but it doesn’t work. The first line reads:
if actual time – article time is smaller then 3 days: do something
instead of $date->time I’ve put $article->date(‘c’, ‘date’)->time to fetch the article time.
Is this correct? What does <?php echo timespan($data->time); ?> mean?