[SOLVED]CGCalendar - Show todays stuff

Have a question or a suggestion about a 3rd party addon module or plugin?
Let us know here.
Post Reply
emlberg
New Member
New Member
Posts: 7
Joined: Mon Aug 22, 2011 11:18 am

[SOLVED]CGCalendar - Show todays stuff

Post 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? :)
Last edited by emlberg on Mon Aug 29, 2011 2:08 pm, edited 1 time in total.
Jos
Support Guru
Support Guru
Posts: 4019
Joined: Wed Sep 05, 2007 8:03 pm

Re: CGCalendar - Show todays stuff

Post 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.
emlberg
New Member
New Member
Posts: 7
Joined: Mon Aug 22, 2011 11:18 am

Re: CGCalendar - Show todays stuff

Post by emlberg »

Thanks dude. It works like a charm! O0
Post Reply

Return to “Modules/Add-Ons”