You are here: Re: [SMARTY] Complex loops - SECTIONS « Smarty Templates Posts « IT news, forums, messages
Re: [SMARTY] Complex loops - SECTIONS

Posted by Messju Mohr on 04/09/05 18:09

On Sat, Apr 09, 2005 at 10:35:30AM +1000, HarryG wrote:
> Hi,
>
> I am basically trying to do the following and need some help.
>
> {section name=count loop=$Photos start=1 step=4}
> <tr>
> <td>{$Photos[count].Filename}</td><td>{$Photos[count+1].Filename}</td><td>{$Photos[count+2].Filename}</td><td>{$Photos[count+3].Filename}</td>
> </tr>
> {/section}
>
> Because my step is 4, I wanna print all the photos from 1-4 in the first row and then 5-8 in the second and so on...

you can try something like this:

{section name=rows loop=$Photos start=1 step=4}
<tr>
{section name=cols start=$smarty.section.rows.index loop=$smarty.section.rows.index+4}

<td>{$Photos[cols].Filename}</td>
{/section}
</tr>
{/section}

greetings
messju


> Thanks in advance
> HarryG

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация