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
Calendar: Check if there is no event in a month
-
steven_germany
- Forum Members

- Posts: 34
- Joined: Tue Apr 21, 2009 6:52 pm
Re: Calendar: Check if there is no event in a month
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.
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

- Posts: 34
- Joined: Tue Apr 21, 2009 6:52 pm
Re: Calendar: Check if there is no event in a month
Velden,
thank you so much!!!! It works
Kind regards
Stefan
thank you so much!!!! It works
Kind regards
Stefan
-
CapereSpiritum
- Forum Members

- Posts: 223
- Joined: Wed Dec 28, 2011 12:11 pm
Re: Calendar: Check if there is no event in a month
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
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

- Posts: 34
- Joined: Tue Apr 21, 2009 6:52 pm
Re: Calendar: Check if there is no event in a month
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}
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}

