[solved] Cataloger - captions for item images?

For questions and problems with the CMS core. This board is NOT for any 3rd party modules, addons, PHP scripts or anything NOT distributed with the CMS made simple package itself.
Post Reply
AmandaBTO
Forum Members
Forum Members
Posts: 51
Joined: Thu Aug 09, 2007 2:40 pm

[solved] Cataloger - captions for item images?

Post by AmandaBTO »

I'm using the Cataloger module for a clothing website and it's just about exactly what I want.  I especially love that the js for switching thumbnails with the big image is already there

But I'd like to display a caption for the thumbnails, like the colour the item is available in

I added as many item user defined attributes as images the user is allowed.  These captions are available in $attrlist the item sub template and I thought it'd be as easy as

Code: Select all

{section name=ind loop=$image_url_array}
<a href="javascript:repl('{$image_url_array[ind]}')"><img src="{$image_thumb_url_array[ind]}" title="{eval var=$attrlist[***].key}" /></a>
{/section}
The problem is that I need *** to be ind + 1 (because notes is the first value in $attrlist) but I don't know how to do that.  It just returns "Array[ind+1].key" for my title because it's taking ind+1 to be a literal value

Any ideas?
Thanks
amanda
Last edited by AmandaBTO on Fri Aug 24, 2007 4:58 pm, edited 1 time in total.
alby

Re: Cataloger - captions for item images?

Post by alby »

AmandaBTO wrote: I'm using the Cataloger module for a clothing website and it's just about exactly what I want.  I especially love that the js for switching thumbnails with the big image is already there

But I'd like to display a caption for the thumbnails, like the colour the item is available in

I added as many item user defined attributes as images the user is allowed.  These captions are available in $attrlist the item sub template and I thought it'd be as easy as

Code: Select all

{section name=ind loop=$image_url_array}
<a href="javascript:repl('{$image_url_array[ind]}')"><img src="{$image_thumb_url_array[ind]}" title="{eval var=$attrlist[***].key}" /></a>
{/section}
The problem is that I need *** to be ind + 1 (because notes is the first value in $attrlist) but I don't know how to do that.  It just returns "Array[ind+1].key" for my title because it's taking ind+1 to be a literal value
Try with (untested, but look here):

Code: Select all

{section name=ind loop=$image_url_array}
<a href="javascript:repl('{$image_url_array[ind]}')"><img src="{$image_thumb_url_array[ind]}" title="$attrlist[$smarty.section.ind.index_next].key}" /></a>
{/section}
Alby
AmandaBTO
Forum Members
Forum Members
Posts: 51
Joined: Thu Aug 09, 2007 2:40 pm

Re: Cataloger - captions for item images?

Post by AmandaBTO »

You are my HERO!

Actual code is:

Code: Select all

...title="{eval var=$attrlist[$smarty.section.ind.index_next].key}"...
Thank you, thank you, thank you
AmandaBTO
Forum Members
Forum Members
Posts: 51
Joined: Thu Aug 09, 2007 2:40 pm

Re: [solved] Cataloger - captions for item images?

Post by AmandaBTO »

Just to add a bit more for anyone else who wants to do something like this...

If I didn't put pictures and captions in all available spots (ie 6 of 10), I'd get:
string(43) "Smarty error: eval: missing 'var' parameter"
for each empty spot

It's because as the section is going through the $image_url_array (with 10 elements) it eventually tries to reference beyond the end of the $attrlist array so I added an if statement to make sure $smarty.section.ind.index_next isn't more that's in $attrlist

Code: Select all

{section name=ind loop=$image_url_array}
    <div class="item_thumb">
    <a href="javascript:repl('{$image_url_array[ind]}')"><img src="{$image_thumb_url_array[ind]}" /></a>
{section name=attrTotal loop=$attrlist}{/section}
{eval var=$smarty.section.ind.index+1 assign=currImg}
{if $currImg < $smarty.section.attrTotal.total}
    {eval var=$attrlist[$smarty.section.ind.index_next].key}
{/if}
    </div>
{/section}
alby

Re: [solved] Cataloger - captions for item images?

Post by alby »

AmandaBTO wrote: Just to add a bit more for anyone else who wants to do something like this...

If I didn't put pictures and captions in all available spots (ie 6 of 10), I'd get:
string(43) "Smarty error: eval: missing 'var' parameter"
for each empty spot
Maybe it's better test if exist (untested always):

Code: Select all

... {if isset($attrlist[$smarty.section.ind.index_next].key)}title="{eval var=$attrlist[$smarty.section.ind.index_next].key}"{/if} ...
Alby
Post Reply

Return to “CMSMS Core”