RE: Re[2]: [SMARTY] switch statement ?

From: Date: Mon, 29 Apr 2002 10:00:48 +0000
Subject: RE: Re[2]: [SMARTY] switch statement ?
Groups: php.smarty.general 
Request: Send a blank email to php-smarty-general+get-3920@lists.php.net to get a copy of this message
I'd prefer prefer to keep if/else and switch constructions on the PHP side, not in the template (ok, it doesn't always end up that way...). True a switch statement is not more complex than a monolithic if-else statement, but in my opinion you should restructure your code if you really need that much functionality in your templates. Another approach could be to iterate (or something similar) over the variables and invoke the assign and display methods multiple times for some template. E.g. using a "table-row-template". Then your templates would merely be containers for static HTML and simple variables. Of course this last approach does increase the number templates considerably, and thereby making the templates part of a site much more complex. -------------------------------------------------------------- Rasmus T. Mohr Direct : +45 36 910 122 Application Developer Mobile : +45 28 731 827 Netpointers Intl. ApS Phone : +45 70 117 117 Vestergade 18 B Fax : +45 70 115 115 1456 Copenhagen K Email : mailto:rmo@netpointers.com Denmark Website : http://www.netpointers.com "Remember that there are no bugs, only undocumented features." -------------------------------------------------------------- > -----Original Message----- > From: Bertrand DUNOGIER [mailto:bdunogier@wanadoo.fr] > Sent: Monday, April 29, 2002 11:31 AM > To: Maciej Uhlig > Cc: Rasmus Mohr; smarty-general@lists.php.net > Subject: Re[2]: [SMARTY] switch statement ? > > > MU> Looks like a part of template design problem: would you > prefer many small > MU> templates or one big template with parts, which would be > chosen by switch? > You can't have either many templates either one big template. You > usually get both, according to what you need... I just think that a > switch case would make things better in some situations. You're free > not to use it if you don't like it :) > > Bertrand > > > >

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