Smarty generation help

For discussion and questions related to CMS Specific templates and stylesheets (CSS), and themes. or layout issues. This is not a place for generic "I don't know CSS issues"
Post Reply
Recon
Forum Members
Forum Members
Posts: 200
Joined: Sat Oct 09, 2010 10:23 am

Smarty generation help

Post by Recon »

Hi,

I have tried to generate CGblog articles in summary template that there are specific html <row> one in three line.

This is what I want to generate:

Code: Select all

<div class="row">

<div class="item">
</div>

<div class="item">
</div>

<div class="item">
</div>

</div> <!-- end row -->

This is how I have tried to do it:

Code: Select all

{foreach from=$items item=entry name='foo'}

{if $smarty.foreach.foo.index is div by 3}
<div class="row">
{/if}

<div class="item">
</div>

{if $smarty.foreach.foo.iteration is div by 3}
</div>
{/if}

{/foreach}

But no. It won't work like this.
User avatar
velden
Dev Team Member
Dev Team Member
Posts: 3497
Joined: Mon Nov 28, 2011 9:29 am

Re: Smarty generation help

Post by velden »

Read this (it's Dutch, but read the code examples and links to more info):
http://forum.cmsmadesimple.org/viewtopi ... 16#p318616

And try this (untested)

Code: Select all

<div class="row">
{foreach from=$items item=entry}

<div class="item">
</div>

{if $entry@iteration is div by 3 and not $entry@last}
</div>
<div class="row">
{/if}
{/foreach}
</div>
Recon
Forum Members
Forum Members
Posts: 200
Joined: Sat Oct 09, 2010 10:23 am

Re: Smarty generation help

Post by Recon »

Perfect!

Thank you.

-R
Post Reply

Return to “Layout and Design (CSS & HTML)”