LISE Categories : Capture Items Inside Category Template

Have a question or a suggestion about a 3rd party addon module or plugin?
Let us know here.
Post Reply
Squire4Hire
Forum Members
Forum Members
Posts: 43
Joined: Wed Dec 09, 2015 11:16 pm

LISE Categories : Capture Items Inside Category Template

Post by Squire4Hire »

Much like martinpescador's post, I'm too am having a hard time trying to understand how to group LISE items by Category.

I've modified the default Category template in an attempt to have the Category Name as a header and the Category Description as a paragraph below it. My goal is to then create a table of all items that apply to each of the Categories - but I cannot seem to figure out how to capture the list of items.

I've attempted to implement a

Code: Select all

{foreach from=$items item=item}
command with no luck.
I've also attempted to call a LISE Detail template from within the Category template with no luck.

The module help suggests a couple (optional) parameters that can be used, but there is no example of how to use them. In particular, I would assume something like

Code: Select all

template_detail="default"
might be useful - but no idea how. Or something like

Code: Select all

show_items="true"
might be used to attach the items to the Category template - but again... I have no idea how to implement it correctly.

Can someone please provide a bit of information, or point towards an example, on how the Category template can be used with the Items list? I'm pretty sure this isn't just a matter of Smarty variable scope...
Squire4Hire
Forum Members
Forum Members
Posts: 43
Joined: Wed Dec 09, 2015 11:16 pm

Re: LISE Categories : Capture Items Inside Category Template

Post by Squire4Hire »

Ok... so I've figured out how to get the items into the Category Template using something like this:

Code: Select all

{LISEDocuments action="category" show_items="true"}
The show_items will attached the items to the Category Template as expected. I've modified the default Category Template to look something like this:

Code: Select all


<!-- categories -->
	{foreach from=$categories item=category}
		{if ({$category->items|count} != 0)}
				<h2>{$category->name|strstr:' ':true}<strong>{$category->name|replace:{$category->name|strstr:' ':true}:''}</strong></h2>
				{if !empty($category->description)}
					<div class="row">
						<div class="col-md-12">
							{if !empty($category->description)}
								{eval var=$category->description}
							{/if}
						</div>
					</div>
				{/if}
				
				{assign var='current_category' value=$category scope=global}
				{LISEDocuments action="default" }		

				<hr>
		{/if}
	{/foreach}
</div>
<!-- categories //-->

This will set the current_category to a global scope so the LISEDocuments action="default" will be able to read what category it's currently on.

I've modified the Summary Template - which should list all the items in the list - to look something like this:

Code: Select all

{if $items|@count > 0}
	
	<em><strong>{$current_category}</strong></em> <br><br><br><br>

	<!-- items -->
	{foreach from=$items item=item}


		<!-- item -->
		<div class="item">
		
			{if !empty($item->fielddefs)}

				<div class="item-properties">
					{foreach from=$item->fielddefs item=fielddef}

						{$fielddef.name} :: {$fielddef.value} <br />
			
					{/foreach}
				</div>
				<!-- field definitions //-->
			{/if}
		

		</div>
		<!-- item //-->

	<br>
	<hr>
	<br>

	{/foreach}


	<!-- items //-->

{/if}
This would normally work great as a starting point to building out the table that I want to put this information in... but how does a person compare the current_category with the item category if the item category only returns an index and not a named value?

Two options:
I either pass the index into the Summary - which I have not been able to figure out how to do.
Or I instantiate another call back into another Categories Template (as per the Summary Default Template example)?!

Is there no way to just get the Category Title from the Item? Or even to get the Category Index from the Categories template?
Post Reply

Return to “Modules/Add-Ons”