The compagny I'm working for is using serendipity as the internal IT news system.
But we keep posting news about forthcoming events (like servers or network maintenance), and we were in need of differentiating "today" in the list of news so the users know "THIS is happening today", and "everything above will happen later".
So we added an attribute to the post during processing to base the style on in the template.
'Hope this will be of interest for you
Florian
--- F:/serendipity/include/functions_entries.inc.php (revision 1639)
+++ F:/serendipity/include/functions_entries.inc.php (working copy)
@@ -924,6 +924,13 @@
}
$dategroup[$key]['date'] = $entries[$x]['timestamp'];
+//<FD
+ // mark the entry if it apply to today
+ $today =date(DATE_FORMAT_2);
+ $dt = date(DATE_FORMAT_2, $entries[$x]['timestamp']);
+ if ($dt == $today)
+ $dategroup[$key]['today']="yes";
+//FD>
$dategroup[$key]['is_sticky'] = (isset($entries[$x]['is_sticky']) && serendipity_db_bool($entries[$x]['is_sticky']) ? true : false);
$dategroup[$key]['entries'][] = &$entries[$x];
}
===================================================================
--- F:/serendipity/templates/carl_contest/entries.tpl (revision 1639)
+++ F:/serendipity/templates/carl_contest/entries.tpl (working copy)
@@ -3,12 +3,21 @@
{foreach from=$entries item="dategroup"}
{foreach from=$dategroup.entries item="entry"}
<div class="serendipity_Entry_Date">
+ {if $dategroup.today}
{if $dategroup.is_sticky}
+ <h3 class="serendipity_date_today">{$CONST.STICKY_POSTINGS}</h3>
+ {else}
+ <h3 class="serendipity_date_today">{$dategroup.date|@formatTime:DATE_FORMAT_ENTRY}</h3>
+ {/if}
+ </div>
+ {else}
+ {if $dategroup.is_sticky}
<h3 class="serendipity_date">{$CONST.STICKY_POSTINGS}</h3>
{else}
<h3 class="serendipity_date">{$dategroup.date|@formatTime:DATE_FORMAT_ENTRY}</h3>
{/if}
</div>
+ {/if}
<div class="serendipity_entry serendipity_entry_author_{$entry.author|@makeFilename} {if $entry.is_entry_owner}serendipity_entry_author_self{/if} ">
<div class='serendipity_entryFooter'>
===================================================================
--- F:/serendipity/templates/carl_contest/style.css (revision 1639)
+++ F:/serendipity/templates/carl_contest/style.css (working copy)
@@ -213,6 +213,10 @@
border-bottom: 1px solid #ddd;
padding: 10px 12px 0 0; }
+.serendipity_date_today {
+ background:yellow;
+ }
+
/* entry title */
.serendipity_title {
font-size: medium;