Re: section title block

From: Date: Mon, 26 Feb 2001 14:23:33 +0000
Subject: Re: section title block
References: 1 2 3  Groups: php.smarty.general 
Request: Send a blank email to php-smarty-general+get-227@lists.php.net to get a copy of this message
On Sun, 25 Feb 2001, Monte Ohrt wrote: > BUT, here comes an entirely different approach... how about we add a > boolean parameter to the {include ...} statement, making the include > conditional. for example: > > {section name=mystuff loop=$data} > > {include file="section_header.tpl" show=%mystuff.first%} > > {* put section rows here *} > > {include file="section_footer.tpl" show=%mystuff.last%} > > {/section} > > > We'll add to Smarty the entities %section.first% and %section.last%, > being true/false depending on the section iteration. We'll also add the > boolean flag "show" (or whatever name is decided) to the include > function, default being true of course. > > This solves several things, first that come to mind: > > * still understandable syntax to designers > * modularizes the template, so section headers/footers are reusable (can > pass parameters, whatever) > * We don't add new syntax to the template engine, keeping smarty a bit > leaner > * very easy to implement :-) I don't think this would be too helpful. Now you have to split your section header/footer items into another template file - gets kind of messy after a while. If we can't implement sectionheader/sectionfooter directly (like I said, this may be difficult with the current parser), then we shouldn't try to go for workarounds like this either. -Andrei * Black holes are where God divided by zero. *

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