Re: How to do two column list using section?

From: Date: Sat, 03 Mar 2001 16:35:22 +0000
Subject: Re: How to do two column list using section?
References: 1  Groups: php.smarty.general 
Request: Send a blank email to php-smarty-general+get-284@lists.php.net to get a copy of this message
Hi, I usually use two different template files (one for the table, and one for a row of the table), and loop them using a PHP construct in my code. I prefer this because it keeps the templates clean of any code (be it Smarty or PHP), and it adds a little bit of modularity because you can have as many template levels as you want, like: row-->table-->main page. Also, if you have one template for a 'table row object', for instance, it's easier to keep the same layout all over the site by using always the same template file. That's what templates are for, anyway :) Just my $0.02 ;) ----- Original Message ----- From: "Jim Harlindong" <jimmy@harlindong.com> To: <smarty@lists.ispi.net> Sent: Saturday, March 03, 2001 5:27 PM Subject: [smarty] Re: How to do two column list using section? > Here's my version: > > <%section name=cat loop=$categories%> > <%if %cat.index% is even%><tr><%if%> > > <td>something here</td> > > <%if %cat.index% is even && %cat.rownum% == %cat.loop% %> > <td>&nbsp;</td> > <%/if%> > > <%if %cat.index% is odd%></tr><%if%> > <%/section%> > > I added a check for the last column if the number of data is odd, I need to > add the last empty column. > > > > --- > You are currently subscribed to smarty as: alain@nvision.lu > To unsubscribe send a blank email to $subst('Email.Unsub') > Visit Smarty's homepage at > http://www.phpinsider.com/php/code/Smarty/

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