Page 1 of 1

ListIt2: Default message once a record has expired?

Posted: Mon Dec 08, 2014 3:08 am
by sugna
CMSMS: 1.11.11 "San Cristobal"
Module: ListIt2

I created a simple module using ListIt2 to display events.

I guess this is a php question not sure.

How would I display a default message for example: "No upcoming Events" when there are no events in the system?

I guess I could create a default event for this with its own template but just checking to see if there is a way without having to initiate a default event by making a default event active every time there are no more events.

Site: http://rodbelldrums.com/ the most recent event will apear next to programs on the home page.
Events page: http://rodbelldrums.com/events/

Summary Template code.

Code: Select all

{if $items|@count > 0}
{foreach from=$items item=item}

<div class="box-inner black">
<div class="venue"><h2><a href="{$item->url}">{$item->venue}</a></h2></div>
<div class="city">{$item->city}, {$item->state}</div>
<div class="date">{$item->date}</div>
<div class="time">{$item->time}</div>
<div class="event-link"><a class="btn btn-primary" href="{$item->url}">Attend</a></div>
</div>
{/foreach}
{/if}
Thanks for your time.

Re: ListIt2: Default message once a record has expired?

Posted: Mon Dec 08, 2014 3:34 am
by paulbaker
Try something like this just after your {/foreach}

Code: Select all

...
{/foreach}

{else}
<p>Sorry no events planned at the moment.</p>

{/if}
Nice and simple because you already have an if statement at the top to work out if there are events. You just need to cope with the "else" which kicks in when there are 0 events.

[SOLVED]Re: ListIt2: Default message once a record has expir

Posted: Mon Dec 08, 2014 2:49 pm
by sugna
Works...Thought so...Awesome thank you Paul!