Re: How to do two column list using section?
| From: | Monte Ohrt | Date: | Sat, 03 Mar 2001 16:42:23 +0000 |
| Subject: | Re: How to do two column list using section? | ||
| References: | 1 2 | Groups: | php.smarty.general |
| Request: | Send a blank email to php-smarty-general+get-285@lists.php.net to get a copy of this message | ||
In this particular example, yours is shorter. BUT, I always tend to
think on broader scope, thus mine is more flexible. You want three rows
instead of two? just change to "even by 3". Four rows? "even by 4"...
and so on.
You can have six of one or half dozen of the other... as you can see, we
are getting many different ideas how to do this. That is the beauty of
Smarty, its so damned flexible you can do whatever you want, or what
best fits your application needs.
Hojtsy Gabor wrote:
>
> > easy ;-)
> >
> > {section name=list loop=$data}
> > {if %list.first%}
> > {* first record, start table row *}
> > <tr>
> > {/if}
> > {* display our cell data *}
> > <td>{$list/data}</td>
> > {if %list.last%}
> > {* last record, close row *}
> > </tr>
> > {elseif %list.index% even by 2}
> > {* record even by 2, start a new row *}
> > </tr><tr>
> > {/if}
> > {/section}
>
> I think my one was easier. Erm... At
> least shorter. What do you think about it Monte?
>
> Goba
> __________________________________________________________________
> Hungarian PHP Manual :: Hungarian PHP Mirror ::
> http://hu.php.net/
> The starintg-point for Hungarian webmasters ::
> http://weblabor.hu/
--
Monte Ohrt <monte@ispi.net>
http://www.ispi.net/