Page 1 of 1

ListIt2 nested foreach within categories

Posted: Tue Jul 28, 2015 1:44 pm
by Simon66
I'm trying to create a FAQ list with ListIt2 that is nested within categories. And failing.

example:

Code: Select all

-category 1
---List Item 1
---List Item 2
---List Item 3
-category 2
---List Item 4
---List Item 5
---List Item 6
This is breaking my brain!!!

Has anyone done this? Is it even possible?

Any help appreciated.

Simon66

Re: ListIt2 nested foreach within categories

Posted: Tue Jul 28, 2015 2:41 pm
by Jo Morg
One possible way would be to call the categories action, and then on the categories template use something along the lines of:

Code: Select all

{foreach from=$categories item=category}
<a class="category-name" href="{$category->url}"{$category->name} ({$category->items|count})</a>
			{if !empty($category->description)}
			<div class="category-description">
				{eval var=$category->description}
			</div>
			{/if}
{LisIt2<instance_name> category=$category->alias}
{/foreach}
Remember to rename LisIt2<instance_name> to the real instance name...