Re: [Fwd: PHPTAL - PHP Template Attribute Language]

From: Date: Mon, 17 Mar 2003 19:07:44 +0000
Subject: Re: [Fwd: PHPTAL - PHP Template Attribute Language]
References: 1  Groups: php.pear.dev php.pear.dev 
Request: Send a blank email to pear-dev+get-14372@lists.php.net to get a copy of this message
-------- Original Message -------- Subject: PHPTAL - PHP Template Attribute Language Date: Wed, 12 Mar 2003 18:26:17 +0100 From: laurent.bedubourg@free.fr (Laurent Bedubourg)
I'm currently working on a PHP implementation of ZPT (Zope Page Templates). I'd like interested people and one or two PEAR veterans to send me their feeling about this project.
I'm really impressed. A while ago I tried (unsuccessfully) to create a prefilter for Smarty, to allow for tal syntax. This is much better. Time to ditch Smarty i think. Except...it has some really useful features... - register prefilter (could you add a 'filter chain to phptal') I use this to get round problems with frontpage / dreamweaver rewriting paths in library items. Also for running templates through HTML tidy for adding missing alt attributes etc. - Template resources can come from filesystem, database, ftp etc using a uri syntax file://path/to/file.tpl.html db://fileid etc If we could add these to phptal it would great.
I'm looking for bugs, TAL/METAL/I18N implementation problems, whish list, etc...
I haven't had a chance to try it out thoroughly, but one problem (I think it's a problem) is that there is no way to leave the default value when the first path isn't resolvable eg... <p>User : <span tal:content="user/emailAddress | default">Anonymous</span> </p> ...in this case, if user has no emailAddress attribute, shouldn't the template render the word 'Anonymous'? Or is default a special variable defined set in the python implementation? I don't think it's in the TAL specs, but another useful addition would be a 'with' attribute to temporarily change context. So that you could then use macros for displaying similar data from different objects eg... /path/to/macros.tpl.html <table metal:define-macro="simpleList"> <tr tal:repeat="item results"> <td>${item/title}</td> <td>${item/lastModifiedDate}</td> </tr> </table> /path/to/display.tpl.html <div tal:with="articles" metal:use-macro="macros.tpl.html/simpleList" /> <div tal:with="books" metal:use-macro="macros.tpl.html/simpleList" /> If you would like any help with the project let me know. If i find any other bugs I'll let you know. -RichardW.

« previous php.pear.dev (#14372) next »