Multiple calendars with dynamic month/year calculation
Posted: Sat Mar 08, 2008 11:33 am
I needed 3 calendars on a page, but couldnt find a script that did this. There where logics with fixed months/years, but nothing dynamically, so I ended up with writing the following logic.....
I created a GCB, where I inserted this logic, the GCB is then called in the template, where the calendars should appear.
Ronny
I created a GCB, where I inserted this logic, the GCB is then called in the template, where the calendars should appear.
Code: Select all
{assign var=maand value=$smarty.now|date_format:"%m"}
{assign var=jaar value=$smarty.now|date_format:"%Y"}
{cms_module module="Calendar" month=$maand year=$jaar}
{if $maand gt 11}
{assign var=maand1 value=$maand+1-12}
{assign var=jaar1 value=$jaar+1}
{cms_module module="Calendar" month=$maand1 year=$jaar1}
{else}
{assign var=maand2 value=$maand+1}
{cms_module module="Calendar" month=$maand2 year=$jaar}
{/if}
{if $maand gt 10}
{assign var=maand3 value=$maand+2-12}
{assign var=jaar3 value=$jaar+1}
{cms_module module="Calendar" month=$maand3 year=$jaar3}
{else}
{assign var=maand4 value=$maand+2}
{cms_module module="Calendar" month=$maand4 year=$jaar}
{/if}