Re: [SMARTY] XML Templates
| From: | Monte Ohrt | Date: | Fri, 10 May 2002 03:09:33 +0000 |
| Subject: | Re: [SMARTY] XML Templates | ||
| References: | 1 | Groups: | php.smarty.general |
| Request: | Send a blank email to php-smarty-general+get-4146@lists.php.net to get a copy of this message | ||
Just to spur a thought, you could try dropping in a prefilter that converts your tal-ish syntax (or any syntax for that matter) to something Smarty understands.
Richard Wall wrote:
--- Andrei Zmievski <andrei@ispi.net> wrote:Is there really a compelling reason to make Smarty templates XML compliantZope'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.