Hi,
I have CMS 1.11.4, and CGCalendar 1.10.4. I am trying to set-up an upcoming list template for an large event. I would like to group the events by day of the week. I am able to set-up the template so the day of the week shows up for each event, but how can I set-up the template so that, for instance, all the "Tuesday" events show up under a "Tuesday" header?
The template I started is below. Thank you for any assistance. I tried moving the Day of the Week to before the {foreach} statement with no luck, and wrapping the template in an additional {foreach} statement, but was unsuccessful there as well.
<div id="events">
{if isset($pastitems) && $pastitems == 0}
{foreach from=$events key=key item=event}
<!--Day of the week Code-->
{if $event.event_date_start|date_format:"%m" == $event.event_date_end|date_format:"%m" || $event.event_date_end == 0}
<h1>{$event.event_date_start|date_format:"%A"}</h1>
{/if}
<!--Event Code-->
<div>
<div>
<p>{$event.event_title}</p>
<p>{if $event.event_details !=""}{$event.event_details}{/if} </p>
.....etc
</div>
</div>
{/foreach}
{/if}
</div>
CGCalendar Group Calendar List by Day
-
cpansewicz
- Forum Members

- Posts: 142
- Joined: Fri Jun 17, 2011 12:22 am
Re: CGCalendar Group Calendar List by Day
Think it would be a good idea to store the day of the week in a variable and every iteration check if it changed (not tested):
Code: Select all
{$previousDay=''}
{foreach from=$events key=key item=event}
<!--Day of the week Code-->
{assign var=currentDay value=$event.event_date_start|date_format:"%e"}
{if $previousDay != $currentDay}
<h1>{$event.event_date_start|date_format:"%A"}</h1>
{$previousDay=$currentDay}
{/if}
...
{/foreach}-
cpansewicz
- Forum Members

- Posts: 142
- Joined: Fri Jun 17, 2011 12:22 am
SOLVED: CGCalendar Group Calendar List by Day
Thanks! Thanks! Thanks! That worked perfectly. I appreciate the assistance very much.

