Dashboard > blojsom > ... > Users Guide > Common Heading For Posts
  blojsom Log In   View a printable version of the current page.  
  Common Heading For Posts
Added by David Czarnecki, last edited by David Czarnecki on Jan 08, 2005  (view change)
Labels: 
(None)

The following Velocity snippet will print out entries for the same day under a heading of the format:

Day_Of_Week, Month Day_In_Month


... template code ...

#set ($hasPrintedDateHeader = 0)
#set ($currentDateFormat = "")

#foreach ($entry in $BLOJSOM_ENTRIES)

#if (!$currentDateFormat.equals($entry.getDateAsFormat("Mdyyyy")))
    #set ($hasPrintedDateHeader = 0)
#end

#if ($hasPrintedDateHeader == 0)
    #set ($currentDateFormat = $entry.getDateAsFormat("Mdyyyy"))
    $entry.getDateAsFormat("EEEE, MMMM dd")
    #set ($hasPrintedDateHeader = 1)
#end

... more template code to print out the title of the entry, body of the entry, etc ...

Site running on a free Atlassian Confluence Open Source Project License granted to blojsom. Evaluate Confluence today.
Powered by Atlassian Confluence, the Enterprise Wiki. (Version: 2.5.4 Build:#809 Jun 12, 2007) - Bug/feature request - Contact Administrators