Calendar: Check if there is no event in a month

Have a question or a suggestion about a 3rd party addon module or plugin?
Let us know here.
Post Reply
steven_germany
Forum Members
Forum Members
Posts: 34
Joined: Tue Apr 21, 2009 6:52 pm

Calendar: Check if there is no event in a month

Post by steven_germany »

Hello,

in a brand new cms installation with updated moduls
i want to check in the calendar if there is no event in
the month. I use the list-template

Just to display the user: "No Events in this month" (or something like that)

Any idea?

Regrads

Stefan
User avatar
velden
Dev Team Member
Dev Team Member
Posts: 3497
Joined: Mon Nov 28, 2011 9:29 am

Re: Calendar: Check if there is no event in a month

Post by velden »

Usually those templates have some kind of array which they iterate to show the items ( {foreach...} )

Read about the foreachelse method
https://www.smarty.net/docs/en/language ... oreach.tpl

This would be useful if you want to show the events if there are any and else show the 'no events' message.

If you just want to check for the non-existence of events then just check the length of the array.
steven_germany
Forum Members
Forum Members
Posts: 34
Joined: Tue Apr 21, 2009 6:52 pm

Re: Calendar: Check if there is no event in a month

Post by steven_germany »

Velden,

thank you so much!!!! It works :-)

Kind regards
Stefan
CapereSpiritum
Forum Members
Forum Members
Posts: 223
Joined: Wed Dec 28, 2011 12:11 pm

Re: Calendar: Check if there is no event in a month

Post by CapereSpiritum »

Hi Steven
I would be very grateful to learn how you did it.
Would you be so kind as to display the {foreach} and any subsequent {if} statement?

Many thanks
Simon
steven_germany
Forum Members
Forum Members
Posts: 34
Joined: Tue Apr 21, 2009 6:52 pm

Re: Calendar: Check if there is no event in a month

Post by steven_germany »

Hi Simon,

it is very simple :-)


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

HERE WRITE ALL THE THINGS FOR DISPLAYING YOUR CALENDAR THINGS

{foreachelse}

HERE WRITE WHAT SHOULD HAPPEN WHEN THERE IS NO ENTRY

{/foreach}
Post Reply

Return to “Modules/Add-Ons”