Re: [SMARTY] 3 photos at one row

From: Date: Fri, 21 Nov 2003 14:38:10 +0000
Subject: Re: [SMARTY] 3 photos at one row
References: 1 2  Groups: php.smarty.general 
Request: Send a blank email to php-smarty-general+get-10576@lists.php.net to get a copy of this message
Jason Hubble wrote: >> {counter name=c1 start=1 skip=3 assign=id2} >> {counter name=c2 start=2 skip=3 assign=id3} >> {section name=id1 loop=$images step=3} >> {* code here for examole *} >> {$images[id1].alt}<br> >> {$images[$id2].alt}<br> {* notice $id2 not id2 *} >> {$images[$id3].alt}<br> >> >> >> {counter name=c2 assign=id2} >> {counter name=c3 assign=id3} >> {/section} >> >> I hope this helps :) > > Can you explain how this example works please? I don't really > understand what is happening. Counter is a custom function. Maybe the following pages can clarify this http://smarty.php.net/manual/en/language.custom.functions.php http://smarty.php.net/manual/en/language.function.counter.php Or give this a try: <TABLE> <TR> {section name=row loop=$images} <TD>{$images[row].src}</TD> {if ($smarty.section.row.rownum % 3) eq 0 AND not $smarty.section.row.last}</TR><TR>{/if} {/section} </TR> </TABLE> Greetings, Jan Rosier * Murphy's First Law: Nothing is as easy as it looks. *

« previous php.smarty.general (#10576) next »