Page 1 of 1

Cataloger assign a class to last item

Posted: Wed May 19, 2010 6:22 pm
by moonoo
Right, this is a bit of a weird one for me as I know what I need to do.. just not how to do it!

Code: Select all

{Cataloger action="random" sub_template="random3" count="3" alias="work"}
Is my code to place onto my home page to randomly pull 3 items from the top Category page called.. Work..

I want to assign the last of the three a class of .last{margin-right:-14px;} so that I can regate the margin and have three sitting next to each other..

NOW if I do this in the Cataloger options/template.. it will only assign it to the third item of the total count.. using this code:

Code: Select all

<div class="mini_portfolio_item_02{if $smarty.section.numloop.index == 2} last{/if}">
Which will be inserted into the tempalte that complete looks like this.

Code: Select all

{section name=numloop loop=$items}
<div class="mini_portfolio_item_02{if $smarty.section.numloop.index == 2} last{/if}">
<div class="block_inside_blank">
<a href="{$items[numloop].link}">
{assign var=photo value=$items[numloop].image_src}
{supersizer path="$photo" URL=true width='100' height='75' class='thumbnail' crop=true quality='100' alt=$items[numloop].title title=$items[numloop].title}</a>
<h2>{$items[numloop].title}</h2>
<p>{$items[numloop].itemnotes}</p>
<p><strong>Category:</strong> <em>{$items[numloop].cat}</em></p>
<a href="{$items[numloop].link}">{$items[numloop].title}</a>
</div>
</div>
{/section}
So my question is..

Can I add a class to the output:

Code: Select all

{Cataloger action="random" sub_template="random3" count="3" alias="work"}
So that the last of the 3 random images rather than the complete array gets the .last class assigned?

Makes sense whoooof that was hard going writting that!

Anyone has a heads up pleeeeeese? :)