Re: [PHP3] Re: [PHP Template] Re: [PHP3] PHP Template Engine spec revision 0.52
[email protected] (John Coggeshall) Tue, 21 Mar 2000 14:23:03 -0500 (EST)
| Newsgroups | php.template |
|---|---|
| Organization | Kettering University (formerly GMI E&MI) - Flint MI |
| Message-ID | <[email protected]> |
> I am providing a solution - you provided it yourself in your example, that
> compared how to implement the template if in PHP code. Use PHP syntax for
> logic, use your templates for presentation. I won't suggest using 'for'
> loops instead of 'while' loops, which you may consider as constructive
> criticism. I suggest moving logic outside of the templates engine
> altogether.
I tend to agree with Zeev here... I see no purpose for templates if they
go byeond this:
<HTML>
<HEAD><TITLE>{TITLE}</TITLE></HEAD>
<BODY><TABLE>
<!-- block -->
<TR>
<TD>{CONTENT}</TD>
<TD>{CONTENT_TWO}</TD>
</TR>
<!-- block -->
</TABLE>
</BODY>
</HTML>
... 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...
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.
John