LISE categories not working when LISE Instance tag present Topic is solved

Have a question or a suggestion about a 3rd party addon module or plugin?
Let us know here.
Post Reply
webform
Power Poster
Power Poster
Posts: 463
Joined: Sat Nov 25, 2006 3:39 pm
Location: Copenhagen, Denmark

LISE categories not working when LISE Instance tag present

Post by webform »

A strange problem I don't understand why is happening. Maybe someone can explain what is going wrong?

If I have both categories and another LISE Instance tag in a LISE summary template, categories stop working. However the first iteration in the loop does output the category.

My summary template:

Code: Select all

{if $items|@count > 0}

<div class="table-responsive">
	<table class="table table-striped">
		<thead>
			<tr>
				<th class="border-top-0">Project Number</th>
				<th class="border-top-0">Project Name</th>
				<th class="border-top-0">Project Type</th>
				<th class="border-top-0">Weight Reports</th>
			</tr>
		</thead>
		<tbody>
			{foreach from=$items item=item}
			{LISELoader item='category' force_array=1 value=$item->project_type assign='cats'}
			{$type= "{$cats|implode:','}"}
			<tr>
				<td class="fw-bold"><a class="link-dark" href="{$item->url}">{$item->project_number}</a></td>
				<td class="fw-bold"><a class="link-dark" href="{$item->url}">{$item->title}</a></td>
				<td>{$type}</td>
				<td>{LISEWeightReports template_summary='itemsCount' xs_project=$item->item_id}</td>
			</tr>
			{/foreach}
		</tbody>
	</table>
</div>

{/if}
However, if I change the way I retrieve categories, I can display categories and the result from the second LISE Instance tag:

Code: Select all

{LISELoader item='category' identifier='category_id' instance='LISEProjects' value=$item->project_type assign='type'}
I have tried inserting my LISE Instance tag in the default summary template and here categories also stop working!
Maybe someone can explain why it is so, so i can learn template logic?
Last edited by webform on Tue Apr 30, 2024 12:44 pm, edited 1 time in total.
User avatar
magallo
Dev Team Member
Dev Team Member
Posts: 110
Joined: Thu Mar 24, 2011 12:37 am

Re: LISE categories not working when LISE Instance tag present

Post by magallo »

Smarty processes template tags sequentially. If two tags or functions interact with each other or require similar resources, their order and mode of execution might interfere with each other.

Try this:

Code: Select all

{if $items|@count > 0}

<div class="table-responsive">
	<table class="table table-striped">
		<thead>
			<tr>
				<th class="border-top-0">Project Number</th>
				<th class="border-top-0">Project Name</th>
				<th class="border-top-0">Project Type</th>
				<th class="border-top-0">Weight Reports</th>
			</tr>
		</thead>
		<tbody>
			{foreach from=$items item=item}
			{* Fetch categories distinctly *}
			{LISELoader item='category' identifier='category_id' instance='LISEProjects' value=$item->project_type assign='type'}
			<tr>
				<td class="fw-bold"><a class="link-dark" href="{$item->url}">{$item->project_number}</a></td>
				<td class="fw-bold"><a class="link-dark" href="{$item->url}">{$item->title}</a></td>
				<td>{$type|implode:','}</td>
				<td>{LISEWeightReports template_summary='itemsCount' xs_project=$item->item_id}</td>
			</tr>
			{/foreach}
		</tbody>
	</table>
</div>

{/if}
webform
Power Poster
Power Poster
Posts: 463
Joined: Sat Nov 25, 2006 3:39 pm
Location: Copenhagen, Denmark

Re: LISE categories not working when LISE Instance tag present

Post by webform »

Thanks! That works perfectly.

Every day is an opportunity to learn something new. Although it can be a frustrating experience. ;D
Post Reply

Return to “Modules/Add-Ons”