Page 1 of 1

[SOLVED] Conflict between CGSmartImage & ListIt2 categories

Posted: Sat Aug 10, 2013 5:04 am
by Simon66
I reported this as a bug, but I was wondering if anyone had a fix or workaround.

SETUP:
Cms Version: 1.11.7
Installed Modules:

AceEditor: 0.2.5
CGExtensions: 1.37.2
CGSimpleSmarty: 1.7
CGSmartImage: 1.12
Captcha: 0.4.6
CustomGS: 1.4
FormBuilder: 0.7.3
GBFilePicker: 1.3.3
Gallery: 1.6.1
ListIt2: 1.4
ListIt2XDefs: 1.2
SEOTools2: 1.2.1
CGCalendar: 1.10.4
ListIt2phoenixgallery: 1.4


I have a summary template in ListIt2:

Code: Select all

<section id="gal-container">
{if $items|@count > 0}
	<ul class="gallery-four-col" id="stage">
	{foreach from=$items item=item}
    {ListIt2Loader item='category' force_array=1 value=$item->fielddefs.categories.value assign='cats'}
	    <li data-tags="{$cats|implode:','}">
            {capture assign='galleryphoto'}{root_url}/uploads/{$item->fielddefs.photo.value}{/capture}
            <a href="#"><img src='{$galleryphoto}'></a>
	    </li>
	{/foreach}
	</ul>
{/if}
</section>
This works perfectly.

But if I add CGSmartImage to the image like this:

Code: Select all

<img src='{CGSmartImage src="$galleryphoto" filter_croptofit="218,168,c" notag=1}'>
It breaks the category part of the summary template and gives me this error: "Loaded instance is not ListIt2 instance." But CGSmartImage works OK.

If anyone else has found a fix/workaround for this please let me know.

Thanks
Simon66

Re: Conflict between CGSmartImage & ListIt2 categories

Posted: Sun Aug 11, 2013 6:47 pm
by Stikki
If you call ANY other module inside LI2 templates, it overwrites actionmodule variable, that LI2 Loader uses to attempt to load data from smarty variable, when using some other module this gets overwritten and you are actually trying to initiate loader with CGSI and not with LI2 instance.

What you need to do is add parameter: instance

into your loader call to force it to some wanted instance.

ie. {ListIt2Loader item='category' force_array=1 instance='ListIt2Instance' value=$item->fielddefs.categories.value assign='cats'}

Re: Conflict between CGSmartImage & ListIt2 categories

Posted: Sun Aug 11, 2013 11:31 pm
by Simon66
Thank you very much for that Stikki :)

I'm onto it now!

Simon66

Re: [SOLVED] Conflict between CGSmartImage & ListIt2 categor

Posted: Fri Nov 08, 2013 1:11 pm
by zaidcrowe
Hey Guys,

I'm running the same set up - but getting the same issue despite adding the instance tag - what am I doing wrong?

Code: Select all

<!--3 column portfolio starts-->
<ul class="portfolio_3column filter_content">
{if $items|@count > 0}	
	<!-- items -->
	{foreach from=$items item=item}
		<!-- item -->
		{foreach from=$item->fielddefs item=fielddef}
			{if $fielddef.type == 'Categories' && ($fielddef.value != '')}
            {ListIt2Loader item='category' force_array=1 instance='ListIt2Instance' value=$fielddef.value assign='cats'}	
		{/foreach}
		<li data-id="id-{$item->position+1}" data-type="{*{foreach from=$cats item=cat}{$cat->alias} {/foreach}*}">
			<div class="folio-thumb"><img src="{CGSmartImage src={$item->image} notag=1 filter_resizetofit="300,245" quality="75"}" alt="image" /> {if !empty($item->site_url)}<a href="{$item->site_url}" data-rel="prettyPhoto[gallery1]" title="{$item->title}" class="icon-zoom"></a>{/if}
			</div>
		</li>
		<!-- item //-->
	{/foreach}
	<!-- items //-->
{/if}
</ul>
<!--3 column portfolio ends-->