Lise - display Category name

Have a question or a suggestion about a 3rd party addon module or plugin?
Let us know here.
Post Reply
User avatar
erpee
Power Poster
Power Poster
Posts: 771
Joined: Sat Jul 07, 2007 9:22 am
Location: Almelo, The Netherlands

Lise - display Category name

Post by erpee »

In my Lise module, I've created a category called: 'cat'
category.jpg
category.jpg (3.85 KiB) Viewed 3263 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'?
Waarom zou het direct goed moeten gaan? Dan is alle lol weg ...
User avatar
Jo Morg
Dev Team Member
Dev Team Member
Posts: 1922
Joined: Mon Jan 29, 2007 4:47 pm

Re: Lise - display Category name

Post 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.
"There are 10 types of people in this world, those who understand binary... and those who don't."
* by the way: English is NOT my native language (sorry for any mistakes...).
Code of Condut | CMSMS Docs | Help Support CMSMS
My developer Page on the Forge
GeekMoot 2015 in Ghent, Belgium: I was there!
GeekMoot 2016 in Leicester, UK: I was there!
DevMoot 2023 in Cynwyd, Wales: I was there!
johnboyuk1
Forum Members
Forum Members
Posts: 192
Joined: Mon Nov 26, 2018 3:09 pm

Re: Lise - display Category name

Post 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}
User avatar
Rolf
Power Poster
Power Poster
Posts: 7825
Joined: Wed Apr 23, 2008 7:53 am
Location: The Netherlands
Contact:

Re: Lise - display Category name

Post by Rolf »

- + - + - + - + - + - + -
LATEST TUTORIAL AT CMS CAN BE SIMPLE:
Migrating Company Directory module to LISE
- + - + - + - + - + - + -
Image
Post Reply

Return to “Modules/Add-Ons”