Re: [SMARTY] XML Templates
| From: | Richard Wall | Date: | Thu, 09 May 2002 22:50:12 +0000 |
| Subject: | Re: [SMARTY] XML Templates | ||
| References: | 1 | Groups: | php.smarty.general |
| Request: | Send a blank email to php-smarty-general+get-4141@lists.php.net to get a copy of this message | ||
--- Andrei Zmievski <andrei@ispi.net> wrote:
> Is there really a
> compelling reason to make Smarty templates XML
> compliant
Zope's 'Template Attribute Language'. It puts all its
code in special tag attributes. Here are two
examples...
<h1 tal:content="$docTitle">The Title</h1>
...would replace the contents of the H1 tag with the
variable $docTitle...
<p tal:repeat="from:stories key:storyId item:story">
<a href="#" tal:content="from:story"
tal:attributes="href:storyId class:headlineLink">First
News Headline</a>
</p>
...loops through the assigned stories array creating
links to each. The link href and class attributes are
set using tal:attributes.
Advantages:
HTML editors by and large ignore the unknown
attributes in tags.
Designers can't see the template logic except when in
HTML view. (This is also a disadvantage if they
accidentally delete or move dynamic tags)
In this case it is ideal to parse the tal bits with
the PHP event based XML parser. I have attached a copy
of my initial work on this. You can also find it at...
http://www.the-moon.net/~richard/downloads/index.htm
...it currently only supports a small subset of
smarty's full capabilities.
If people are interested, there's lots of info about
tal and metal on the Zope site.
Also if anyone's got any ideas about, or wants to help
develop a tal(ish) compiler for smarty, then let me
know.
--
RichardWall
=====
Richard Wall
tel: 0794 1199105 PGP Key ID: 0xAC33A456
__________________________________________________
Do You Yahoo!?
Everything you'll ever need on one web page
from News and Sport to Email and Music Charts
http://uk.my.yahoo.com