Link multiple LISE items to a page

Have a question or a suggestion about a 3rd party addon module or plugin?
Let us know here.
Post Reply
brentnl
Power Poster
Power Poster
Posts: 493
Joined: Mon May 11, 2009 4:35 pm

Link multiple LISE items to a page

Post by brentnl »

I've had a previous question about LISE in this topic but unfortunately it's closed now.

I've managed to display a single LISE item at a content page using CGContentUtilities, where it's possible to select the item while editing the page itself.

But now my client wants the possibility to display multiple items at one page. I've changed the CGCU dropdown into an 'multiselection' , which works fine for selection, but I don't know how to proceed at the page-template to display the info of 2 or more items.

Snippet of the page template;

Code: Select all

<div class="card-body">
{content_module module='CGContentUtils' block='team_items' assign=specialist}
{LISETeam item=$specialist template_detail=empty action=detail}
{capture assign="teamfoto"}uploads/images/team/{$LISEitem->foto}{/capture}

<div class="row">
<div class="col-lg-5 no-padding-right">
<img src="{CGSmartImage src=$teamfoto filter_croptofit="250,250,c" notag=1 noembed=1}" class="img-fluid rounded-circle"/>
</div>

<div class="col-lg-7 extrapadding">
<h3>{$LISEitem->title}</h3>
<span>{$LISEitem->fielddefs['achternaam']->value}</span>
</div>
</div>
</div>
Do I need to implement some kind of {foreach} array?
User avatar
DIGI3
Dev Team Member
Dev Team Member
Posts: 1625
Joined: Wed Feb 25, 2009 4:25 am
Location: Victoria, BC

Re: Link multiple LISE items to a page

Post by DIGI3 »

For a detail template, yes foreach would be best.

If you want to do a summary template instead, You should be able to implode the array:

Code: Select all

{LISETeam include_items="{','|implode:$specialist}" template_summary='foo'}
(note, this assumes it's an array coming from CGCU, if it's just a csv then you don't need the implode and can just include_items=$specialist. I couldn't remember off-hand which it was)

Unrelated, try to assign variables directly instead of using capture, it's more efficient:

Code: Select all

{$teamfoto="{uploads_url}/images/team/{$LISEitem->foto}"}
Not getting the answer you need? CMSMS support options
brentnl
Power Poster
Power Poster
Posts: 493
Joined: Mon May 11, 2009 4:35 pm

Re: Link multiple LISE items to a page

Post by brentnl »

DIGI3, thanks!

It works like a charm! One thing which was a bit confusing; I've used a multiselect box from CGCU, so I thought I should use the 'implode' option, but I had to use the csv-one instead. Could you explain why?
User avatar
DIGI3
Dev Team Member
Dev Team Member
Posts: 1625
Joined: Wed Feb 25, 2009 4:25 am
Location: Victoria, BC

Re: Link multiple LISE items to a page

Post by DIGI3 »

I think csv is standard for multiselect results. They could be assigned to an array, but if it's not needed then it's easier to have it as a csv for simple form processing.
Not getting the answer you need? CMSMS support options
Post Reply

Return to “Modules/Add-Ons”