differentiating "Today" in the posts lists

Random stuff about serendipity. Discussion, Questions, Paraphernalia.
Post Reply
fdeckert
Posts: 3
Joined: Wed Mar 07, 2007 8:53 pm
Location: france

differentiating "Today" in the posts lists

Post by fdeckert »

Hi people,

We are using serendipity in our company as an IT news system rather than a blog.

So we are posting forthcoming events like servers or network shutdown, and we wanted a way for people reading the posts to quickly spot the events of the current day.

We first patched serendipity, But almighty Gavin :wink: provided us a trick in the smarty template itself:

Code: Select all

{foreach from=$entries item="dategroup"}
{foreach from=$dategroup.entries item="entry"}
<div class="serendipity_Entry_Date">
{if $dategroup.is_sticky}
<h3 class="serendipity_date">{$CONST.STICKY_POSTINGS}</h3>
{elseif $dategroup.date|@date_format:'%Y%m%d' == $smarty.now|@date_format:'%Y%m%d'}
<h3 class="serendipity_date_today">{$dategroup.date|@formatTime:DATE_FORMAT_ENTRY}</h3>
{else}
<h3 class="serendipity_date">{$dategroup.date|@formatTime:DATE_FORMAT_ENTRY}</h3>
{/if}
</div>
[code] 

You can add a new style in the CSS file to mark the date:
.serendipity_date_today {
 background:red;
 }
Post Reply