Page 1 of 1

Category titles switching from Listit2 to LISE

Posted: Sat Oct 22, 2016 2:09 pm
by martinpescador
Hello together,

I have a question about LISE after updating from Listit2. I have some entries as "accordeon links" which extend on click (containing a text ("beschreibung" and some images ("gallery")), which should be sorted by category, with the category as a title. Like this:

Category 1
Entry 1 (extends on click)
Entry 2 (extends on click)
Entry 3 (extends on click)

Category 2
...


In Listit2, I managed to do it like that:

Code: Select all

{assign var='current_category' value=''}
{assign var='open' value=false}

{foreach from=$items item=item}

{if $current_category != $item->category_alias}
    {if $open}</div><!-- items -->{/if}
    <h1 class="category-title">{$item->category_name|cms_escape}</h1>
    <div class="items">
    {assign var='current_category' value=$item->category_alias}
    {assign var='open' value=true}
{/if}

<div id="accordion" class="item">
<h2 class="item-title">{$item->title|cms_escape}</h2>
<div class="item-content">
{if !empty($item->fielddefs)}
    <div class="item-properties">
    {foreach from=$item->fielddefs item=fielddef}
      
                         {if !empty($fielddef.value) && ($fielddef.name != 'gallery')}  
    {$fielddef.value|cms_escape}
{/if}
                         
       
    {/foreach}
{capture assign="gallery"}{$item->fielddefs.gallery.value}{/capture}
{Gallery dir=$gallery template="fancybox"}

   </div> </div>
{/if}
</div>
{/foreach}
</div>
That doesn't work anymore, and now I am trying since quite some time, and I cant really figure out how to get the same results, because I do not really understand the rules which apply depending on which template category (category, summary, detail, search) is selected actually.

Can you give me a hint how I would have to proceed to display the categories?
Thank you very much already.

Re: Category titles switching from Listit2 to LISE

Posted: Mon Oct 24, 2016 1:23 pm
by Jo Morg
You may be struggling with Smarty variable scopes. Check this article in Rolf's tutorials site. That might help.