LISE : Get Number Of Items In Instance

Have a question or a suggestion about a 3rd party addon module or plugin?
Let us know here.
Forum Members
Forum Members
Posts: 43
Joined: Wed Dec 09, 2015 11:16 pm

LISE : Get Number Of Items In Instance

Post by Squire4Hire »

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?

User avatar
Dev Team Member
Dev Team Member
Posts: 7735
Joined: Wed Apr 23, 2008 7:53 am
Location: The Netherlands

Re: LISE : Get Number Of Items In Instance

Post by Rolf »

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'}"}
- + - + - + - + - + -
Latest CMSMS tutorial: FormBuilder WatchGuard
- + - + - + - + - + -
Did my post help you solving a problem at your (customers) website and it saved you many hours of work?
Great!! Buy me a cup of coffee in return as a small token of appreciation!
Support Guru
Support Guru
Posts: 8169
Joined: Tue Oct 19, 2004 6:44 pm
Location: Fernie British Columbia, Canada

Re: LISE : Get Number Of Items In Instance

Post by calguy1000 »

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.

Return to “Modules/Add-Ons”