Page 1 of 1

Calendar Template Script

Posted: Thu Mar 15, 2007 10:00 am
by EwedaMaan
ok so I have been tinkering with the calendar template script here http://www.quin.ie/index.php?page=main-hall, and I have got it in columns now, but what I need to do next is to have the days of the week start with the correct day, and then repeat for each day of the month. below is a part of the template that I have edited so far. I would appreciate any help thanks


{*Table starts here*}


{* iterate over the days of this month *}
{assign var=weekday value=$first_of_month_weekday_number}
{foreach from=$days item=day key=key}


{* Generate the Days of the week *}
{$day_short_names[$key]}
{if $weekday == 7}
{assign var=weekday value=1}
{/if}


{*Generate Dates of months*}

{if isset($day.events.0)}{$key}


{*Generate Events for each Day*}

{if $summaries == true}

{foreach from=$day.events item=event}
{$event.event_title}
{/foreach}

{/if}
{else}{$key}{/if}

{math assign=weekday equation="x + 1" x=$weekday}
{/foreach}



Re: Calendar Template Script

Posted: Thu Mar 15, 2007 10:31 am
by chead
You'll need to steal some code back from the original Calendar template and work it in. There's a bit in there that keeps the "day" counter cycling through seven values; when it hits "7" it's reset to zero.

Here are the relevant bits from that template. It's not usable as is since the formatting's different from yours with rows being split to make 7 columns instead of running vertical, but maybe a starting point.

Code: Select all

{* iterate over the days of this month *}
{assign var=weekday value=$first_of_month_weekday_number}
{foreach from=$days item=day key=key}
	{if $weekday == 7}
		{assign var=weekday value=0}
		</tr>
		<tr>
	{/if}
... code omitted
	{math assign=weekday equation="x + 1" x=$weekday}