Page 1 of 1

Link multiple LISE items to a page

Posted: Mon Oct 08, 2018 9:43 pm
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?

Re: Link multiple LISE items to a page

Posted: Mon Oct 08, 2018 10:47 pm
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}"}

Re: Link multiple LISE items to a page

Posted: Thu Oct 18, 2018 7:38 pm
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?

Re: Link multiple LISE items to a page

Posted: Thu Oct 18, 2018 11:16 pm
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.