• twitter image
  • facebook image
  • youtube image
  • linkedin image
Language: CMS Made Simple Czech CMS Made Simple France CMS Made Simple Spain CMS Made Simple Hungary CMS Made Simple Russia CMS Made Simple Netherlands

All times are UTC




Post new topic This topic is locked, you cannot edit posts or make further replies.  [ 3 posts ] 
Author Message
 Post subject: LISE : Get Number Of Items In Instance
PostPosted: Tue Aug 16, 2016 7:26 pm 
Offline
Forum Members
Forum Members

Joined: Wed Dec 09, 2015 11:16 pm
Posts: 43
Is it possible to get the number of items in a LISEInstance without being inside a summary or details template?

I'm trying to write some logic on my main page that will determine whether or not to display a message based on the number of items in the LISEInstance - but I can't figure out how to either determine if the Instance is empty or if the count = 0.

Any suggestions?

Thanks.


Top
  Profile  
 
Share On:
Share on Facebook Share on Twitter Share on Google+
 Post subject: Re: LISE : Get Number Of Items In Instance
PostPosted: Tue Aug 16, 2016 9:02 pm 
Offline
Dev Team Member
Dev Team Member
User avatar

Joined: Wed Apr 23, 2008 7:53 am
Posts: 7714
Location: The Netherlands
I use this in Uploads module.
Similar should work for LISE and other modules.

Create a summary template named i.e. 'itemcount' with content only {$items|@count}

Show the number in the frontend with {Uploads summarytemplate='itemcount'}

or attach it to a string like {$itemcount = "{Uploads summarytemplate='itemcount'}"}

_________________
$1

Did my post help you solving a problem at your (customers) website and it saved you many hours of work? Great!! Consider buying me a cup of coffee in return!



Top
  Profile  
 
Share On:
Share on Facebook Share on Twitter Share on Google+
 Post subject: Re: LISE : Get Number Of Items In Instance  Topic is solved
PostPosted: Tue Aug 16, 2016 9:29 pm 
Offline
Power Poster
Power Poster
User avatar

Joined: Tue Oct 19, 2004 6:44 pm
Posts: 8172
Location: Fernie British Columbia, Canada
You can usually save multiple calls to the database, and lots of extra logic processing by simply doing something like this:

{ModuleCall assign='foo'}
{if !empty($foo)}{$foo}{else}MESSAGE{/if}

If you need the 'foo' stuff in a different template or in the body vs. the head etc. do a:
{ModuleCall assign='foo'}{$foo=$foo scope=global}

Or you can modify the module template to have that if statement/message in it and save even more processing.

_________________
Follow me on twitter
Please post system information from "Extensions >> System Information" (there is a bbcode option) on all posts asking for assistance.
--------------------
If you can't bother explaining your problem well, you shouldn't expect much in the way of assistance.


Top
  Profile  
 
Share On:
Share on Facebook Share on Twitter Share on Google+
Display posts from previous:  Sort by  
Post new topic This topic is locked, you cannot edit posts or make further replies.  [ 3 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Hosting Nation - Managed CMSMS Hosting