[SOLVED] CGCalendar: checking if events exist at all

Have a question or a suggestion about a 3rd party addon module or plugin?
Let us know here.
Post Reply
Guido
Forum Members
Forum Members
Posts: 221
Joined: Sat Aug 29, 2009 3:00 pm

[SOLVED] CGCalendar: checking if events exist at all

Post by Guido »

Hi,

I've been wrapping my head around this and googling for a while, but I can't seem to find the answer (while I think it should be quite simple).

I have a page where in the sidebar I call the upcoming events of the CGCalendar module. The thing is, sometimes the calendar will hold no upcoming events. In that case I would like to hide the calendar block.

I tried modifying my upcoming events template like:

Code: Select all

{if isset($events)}
{assign var="present" value="yes"}
{else}
{assign var="present" value="no"
{/if}
In the top of the template. In the page template I would then check the "present" value to decide whether to show the calendar block or not.

But it seems that when no upcoming events are present, the upcoming events template is never even called, so the value for "present" is never set.

Now I'm trying to figure out how to check from my page template if the CGCalendar $events array is set, but I'm striking out. Anyone have any ideas?
Last edited by Guido on Tue Jun 03, 2014 1:39 pm, edited 1 time in total.
uniqu3

Re: CGCalendar: checking if events exist at all

Post by uniqu3 »

You could assign CGCalendar module tag with upcomminglist to a smarty variable and do your logic in page template

Code: Select all

{CGCalendar display='upcominglist' assign='upcoming_list'}
{if !empty($upcoming_list)}
{$upcoming_list}
{/if}
Guido
Forum Members
Forum Members
Posts: 221
Joined: Sat Aug 29, 2009 3:00 pm

Re: CGCalendar: checking if events exist at all

Post by Guido »

Dude, you saved my life again. Knew it had relatively easy but I couldn't figure it out.

Thanks!
Post Reply

Return to “Modules/Add-Ons”