Re: [PHP3] Re: [PHP Template] Re: [PHP3] Re: [PHP Template] Template Discussion

From: Date: Wed, 22 Mar 2000 21:15:23 +0000
Subject: Re: [PHP3] Re: [PHP Template] Re: [PHP3] Re: [PHP Template] Template Discussion
Groups: php.template 
Request: Send a blank email to php-template+get-428@lists.php.net to get a copy of this message
>On Wed, 22 Mar 2000, John Coggeshall wrote: >> How about this... >> >> backend.php3 >> -=-=-=-=-=-=-=- >> function loop($arrayvar) { >> >> for($loop = 0; $loop <= count($arrayvar); $loop++) { >> >> echo $arrayvar[$loop]; >> echo $arrayvar[$loop]; >> echo $arrayvar[$loop]; >> >> } >> >> } >> -=-=-=-=-=-=-=- >> EOF backend.php3 >> >> Then your "template".... >> >> <? loop($Name); ?> >> >> >> Now I'm definately not a designer... but boy that looks simple to me. >I don't think that's going to be of much use. What if the designer wants >to put each loop iteration in a table row? Alternate the background >colors on each row? Bold it? Italicize it? You would have to modify >backend.php3 - and lose the separation of form and content. Okay about about this then: <?php function loop($preHTML, $var, $postHTML) { echo $preHTML; if(is_array($var)) { for($l = 0; $l <= count($var); $l++) { echo $var[$l]; } } else { echo $var; } echo $postHTML; } Then in your file <? loop("<TD BGCOLOR=#FFFFFF ALIGN=LEFT><B>", $var, "</B></TD>"); ?> No syntax changes needed. John

« previous php.template (#428) next »