ListIt2: Default message once a record has expired?

Have a question or a suggestion about a 3rd party addon module or plugin?
Let us know here.
Post Reply
User avatar
sugna
Forum Members
Forum Members
Posts: 196
Joined: Wed Oct 10, 2007 3:04 pm
Location: USA

ListIt2: Default message once a record has expired?

Post 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.
User avatar
paulbaker
Dev Team Member
Dev Team Member
Posts: 1465
Joined: Sat Apr 18, 2009 10:09 pm
Location: Maidenhead, UK
Contact:

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

Post 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.
To copy System Information to the forum:
https://docs.cmsmadesimple.org/troubles ... nformation

CMS Made Simple Geekmoots attended:
Nottingham, UK 2012 | Ghent, Belgium 2015 | Leicester, UK 2016
User avatar
sugna
Forum Members
Forum Members
Posts: 196
Joined: Wed Oct 10, 2007 3:04 pm
Location: USA

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

Post by sugna »

Works...Thought so...Awesome thank you Paul!
Post Reply

Return to “Modules/Add-Ons”