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.
LISE : Get Number Of Items In Instance
-
- Forum Members
- Posts: 43
- Joined: Wed Dec 09, 2015 11:16 pm
Re: LISE : Get Number Of Items In Instance
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'}"}
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 TUTORIAL AT CMS CAN BE SIMPLE:
Migrating Company Directory module to LISE
Migrating Company Directory module to LISE
- + - + - + - + - + - + -
-
- 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
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.
{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.
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.