Calendar Template Script

For questions and problems with the CMS core. This board is NOT for any 3rd party modules, addons, PHP scripts or anything NOT distributed with the CMS made simple package itself.
Post Reply
EwedaMaan
Forum Members
Forum Members
Posts: 14
Joined: Fri Aug 18, 2006 7:20 pm

Calendar Template Script

Post 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}


User avatar
chead
Forum Members
Forum Members
Posts: 63
Joined: Tue Feb 06, 2007 4:01 am
Location: Dallas, TX

Re: Calendar Template Script

Post 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}
Post Reply

Return to “CMSMS Core”