ListIt2 nested foreach within categories

Have a question or a suggestion about a 3rd party addon module or plugin?
Let us know here.
Post Reply
Simon66
Power Poster
Power Poster
Posts: 250
Joined: Wed Aug 29, 2007 4:36 am

ListIt2 nested foreach within categories

Post 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
User avatar
Jo Morg
Dev Team Member
Dev Team Member
Posts: 1978
Joined: Mon Jan 29, 2007 4:47 pm

Re: ListIt2 nested foreach within categories

Post 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...
"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!
Post Reply

Return to “Modules/Add-Ons”