Page 1 of 1

Lise - display Category name

Posted: Thu May 21, 2020 7:39 am
by erpee
In my Lise module, I've created a category called: 'cat'
category.jpg
category.jpg (3.85 KiB) Viewed 399 times
The category is filled with data like this:
category 2.jpg
In my template I want to use te data using:

Code: Select all

{$item->fielddefs.cat.value}<br />
But, When I expect 'M3', it shows '1'
Is there a way to to make it show the 'M3'?

Re: Lise - display Category name

Posted: Thu May 21, 2020 12:56 pm
by Jo Morg
Look at the sample templates! They serve as documentation too.
LISE categories are arrays so the way you get the values depend both on how you have the categories set up and on how you want to display them on your template.

Re: Lise - display Category name

Posted: Thu Oct 15, 2020 1:18 pm
by johnboyuk1
bit late, but as I was just looking for the solution myself thought I'd post here what I'd worked out for the benefit of anyone else... this is the code I've put in my summary template in order to display the category name associated with each item

Code: Select all

{foreach from=$item->fielddefs item=fielddef}
{if $fielddef.type == 'Categories' && ($fielddef.value != '')}
{LISELoader item='category' force_array=1 value=$fielddef.value assign='cats'}
Category: {implode(',', $cats)}
{/if}
{/foreach}

Re: Lise - display Category name

Posted: Thu Oct 15, 2020 5:26 pm
by Rolf