Page 1 of 1

[SOLVED]CGCalendar - Show todays stuff

Posted: Tue Aug 23, 2011 12:10 pm
by emlberg
I want CGCalendar to show the todays stuff in the Calendar.

{cms_module module="CGCalendar" display="list"}

Im using the following components:
CGCalendar 1.7.4
CGExtensions 1.26.6
CMS version
1.9.4.2
phpversion:
5.2.17

Do I need some sort of Smarty in the list-template to check if the todays date is the same as the item in the calendar? Or is there any other way to do this? :)

Re: CGCalendar - Show todays stuff

Posted: Thu Aug 25, 2011 3:38 pm
by Jos
I think the display='list' is the best way to this.

You can edit the sample template in the "List Templates" tab.

change the line

Code: Select all

{foreach from=$events key=key item=event}
to

Code: Select all

{assign var=datenow value=$smarty.now|date_format:"%Y-%m-%d"}
{foreach from=$events key=key item=event}
{if $event.event_date_start|date_format:"%Y-%m-%d" == $datenow || ($event.event_date_start|date_format:"%Y-%m-%d" <= $datenow && $event.event_date_end|date_format:"%Y-%m-%d" >= $datenow)}
and put an {/if} tag just before the {/foreach}

Then only the events of today will be shown.

Re: CGCalendar - Show todays stuff

Posted: Mon Aug 29, 2011 2:08 pm
by emlberg
Thanks dude. It works like a charm! O0