Re: [PHP3] Re: [PHP Template] Re: [PHP3] PHP Template Engine spec revision 0.52

[email protected] (Andrei Zmievski) Tue, 21 Mar 2000 13:42:05 -0600
Newsgroups php.template
Message-ID <[email protected]>
On Tue, 21 Mar 2000, John Coggeshall wrote:
> ... I'll be the first one to admit that I would *really* like at times to
> have a <?php if($this): ?> statement in my template... it'd be great....
> but I can acccomplish the same thing like this... take, for example... if
> I want to include a piece of javascript or not based on the
> $HTTP_USER_AGENT variable. 
> 
> // {CONTENT} represents a link (pseudo-code)
> 
> $link = "<A HREF='".$URL."'";
> 
> if($browserver >= 4) $link .= " onMouseover='dojavascript();' ";
> 
> $link .= ">".$LINKNAME."</A>";
> 
> SetVar("CONTENT", $link);
> 
> 
> Volia... I've included HTML (err.. javascript) code based on a
> conditional... My point is this... although it might not be as absolutely
> cut-and-dry to use 
> 
> {CONTENT}
> 
> instead of
> 
> <A HREF="{URL}" {IF @BROWSERVER >= 4}onMouseOver='dojavascript();'{/IF}{LINKNAME}</A>
> 
> you actually have a LOT more realibility with the former...

The philosophy that I subscribe to is that PHP script should not have a
single line or string that will appear in the output. Everything that
can appear in the output should be in the template. That way, it can be
easily localized and so on. With the example that you gave, you compose
pieces of HTML in your PHP script, in my personaly opinion, that's bad.
Maybe the word 'template' means different things to different people.
You want it to be just a set of placeholders where your PHP script
places the things it composes.

> besides.... not only do I *NOT* want to learn another lanaguge if I want
> templates... I wouldn't trust the lanaguage to function as expected... my
> sites need to work, a PHP3 has earned my trust as-is.

So, you're saying you don't trust anything new?

-Andrei

'Any given program, when running correctly, is obsolete.'
  - First Law of Computer Programming