Re: [PHP Template] Re: [PHP3] template engine example document

From: Date: Mon, 27 Mar 2000 15:32:15 +0000
Subject: Re: [PHP Template] Re: [PHP3] template engine example document
References: 1 2  Groups: php.template 
Request: Send a blank email to php-template+get-475@lists.php.net to get a copy of this message
On Sun, 26 Mar 2000, Ron Chmara wrote: > If I find the variables to send to the logic, do I win? :-) Well, it's not a game of win and lose here.. :) > > I suppose you could do it that way, or if the designer specifies iteration, they > could write one include, and have the designer insert 5 includes. Designers don't control iterations. Not at all. > Here's a counter question. How would your templates allow them to, oh, > print resuts 12345 as 3151245? I don't quite understand this question. Perhaps, you could explain? > Do they control *appearance*, or, as this debate goes into syntax > wars, do they control *syntax* of those variables? Syntax of the variables? I fear that I fail to grasp your meaning. > <? include "dbresultcounter.inc" ?><---Result counter for db work, uses > the count function---> > There were a total of <? echo $resultcount ?> document(s) found. > OR > <? echo $standardhitext ?> <!---This allows for logic to control the > text varying between was/were hit/hits ---> Assuming the programmer knows ahead of time that the designer needs $standardhittext. Otherwise, the designer needs to come back to the programmer and say, "Give me this variable". > Does your counter-controlled-by-designer-template allow them to > specify the numbering style? (one, two,1,2,I,II,)? No, that would need to be done from a PHP script. Because those numbers are part of the content which the designer does not control. The designer controls the _presentation_ of that, whether those numbers are in a table cell or bolded or something else. > much the same thing. You're trying to jumpstart it by giving them > pre-defined "functions" that they can wrap in HTML (the loop seems > to be the most common one), but the hit you're taking is in evil > Grep madness, to get the variable tags. Grep? We're not doing any grep. > Pass the html tags to the general logic, and be done with it. By the time > you've built all the logic, you have the function, only you don't have > *all the variables*. By the time you have all the functions available > in HTML coded into the PHP template-language-parser (<B>, <STRONG>, > <EMP> to pull into the template parser, you're still lacking the > _functions_ that designers will want the code to generate, so put > the tag control back into their hands, and set coders to work on > the functions themselves. This is still not clear to me.... > Maybe you already have the following document: For each logic > block, what are the designer vars, and what are the logic vars? > Can design vars be put into the logic by the designer? Yes? Then > how? By a new syntax for a $var? :-) ..as is this. Design vars put into the logic? > As you make the templates more complex, you rebuild PHP code to handle > each exception. By focusing on what set of exceptions (coding in loops), > you're missing the very reason PHP got so big... because, well, when your > designer says "now, this link makes a PDF", or "this link searches > LDAP" you now have to again build everything _twice_. Once in PHP, > and once in your new syntax, to allow the templates to use a new way > of passing your vars. Designer is not going to say "this link makes PDF". That's content again, which is programmer's responsibility. > Don't rebuild lots of templates, or recode lots of pages... when you want > to change the color of all the site text (except for what they've overridden > locally), you change one *variable*. Not 30 templates, one, single, variable... And we do that, by changing one setting in the config file that gets loaded by the templates. > Make an include with all the required components. Pass standard > variable names. $searchstring gets used an awful lot. :-) Need custom > variables for a section? Make one include, with all the variables > for a given section. Let the designers control the page vars, with the > coders controlling the logic vars. When you need to pass vars between > the two, do it in a standard manner. This bit about "passing the vars between the two" is another thing you might need to explain. -Andrei Give a man a fish; you have fed him for today. Teach a man to use the Net and he won't bother you for weeks. -Author unknown

« previous php.template (#475) next »