Page 1 of 1

Calendar Upcoming Events Template (Foreach Event Start Day)

Posted: Wed Dec 10, 2008 6:09 am
by Ronseal
I All,
I installed CMSMS yesterday and also bolted on the calendar module and although I've been reading this forum for about two hours I can't quite find the info I'm after.

What I'd like to do is display events from the Calendar in an 'Upcoming Events' list view but have it grouped by Event Start Date.  I have days with multiple events so the 'Event Start Day' is the most important divider for me. Then after that, and appearing on one line, I'd like to see 'Start Time' and 'Title'. (And have both Start Time and Title as a link)

For example:











Sorry to ask so much when I've only just joined, however although I've copied the 'sample' template from the calendar's 'upcoming templates' and tried some tweeking, I just can't get my head around it.  I don't know a great deal about php or css, but I am trying my best to learn.

Cheers
Ron

Re: Calendar Upcoming Events Template (Foreach Event Start Day)

Posted: Mon Dec 15, 2008 12:50 pm
by Ronseal
Come on Guys and Girls, has nobody any ideas of how this can be done?
I've attached the 'Calendar/List Templates/Sample' code to show you my dialema.   ;)

Cheers
Ron
{if $compact_view neq 1}
{$lang.prev}     {$lang.next}

{if $day > 0}{$day} {/if}{$month_names[$month]} {$year}
{/if}
{foreach from=$events key=key item=event}

{$event.event_title}

{assign var=month_number value=$event.event_date_start|date_format:"%m"}
{assign var=end_month_number value=$event.event_date_end|date_format:"%m"}
{if $event.event_date_start == $event.event_date_end || $event.event_date_end == 0}
{$lang.date}: {$event.event_date_start|date_format:"%e"} {$month_names[$month_number]} {$event.event_date_start|date_format:"%Y"}
{else}
{if $event.event_date_start|date_format:"%d%m%Y" == $event.event_date_end|date_format:"%d%m%Y"}
{$lang.date}: {$event.event_date_start|date_format:"%e"} {$month_names[$month_number]} {$event.event_date_start|date_format:"%Y %H:%M"} {$lang.to} {$event.event_date_end|date_format:"%H:%M"}
{else}
{$lang.date}: {$event.event_date_start|date_format:"%e"} {$month_names[$month_number]} {$event.event_date_start|date_format:"%Y %H:%M"} {$lang.to} {$event.event_date_end|date_format:"%d"} {$month_names[$end_month_number]} {$event.event_date_end|date_format:"%Y %H:%M"}
{/if}
{/if}
{if $event.event_summary !="" && ($detail != 1 || ($event.event_details =="" ||  $event.event_details == "
"))}
{$lang.summary}: {$event.event_summary}
{/if}
{if $detail == 1}
{if $event.event_details !="" && $event.event_details != "
"}
{$lang.details}: {$event.event_details}
{/if}
{else}
{$moretext}
{/if}


{/foreach}

{if $return_url != ""}
{$return_url}
{/if}

Re: Calendar Upcoming Events Template (Foreach Event Start Day)

Posted: Thu Dec 25, 2008 9:38 pm
by Dr.CSS
You need to find what call produces the parts you are looking for...

In the template you are using put a number before or after the calls/parts that have some kind of action, like...


{if $day > 0}{$day}1 {/if}{$month_names[$month]}2 {$year}3
{/if}
{foreach from=$events key=key item=event}
 
  {$event.event_title}4

{$lang.date}: 5{$event.event_date_start|date_format:"%e"} 6{$month_names[$month_number]}7 {$event.event_date_start|date_format:"%Y"}8

This way you will know what call does what and even if it gets used then you can take those parts and build the template you need...