[ZPT] Client side TAL implementation

Dany Patrie dany at 180solutions.com
Thu May 26 11:46:31 EDT 2005


Greetings,

 

First of all, I want to apologize for any grammar errors I may do because
English is not my primary language. We, at my workplace, are currently in
the process of evaluating new technologies and we will use XML-RPC to fetch
data from the server and we thought we could use some kind of client side
templating engine. We then came across the *rough* version of "domtal" made
by Joachim Zobel (jzobel at heute-morgen.de). It was a little buggy but we
liked the concept. So we have done a rewrite based on some of his code. It
works fine, needs a little fine tuning, but basically it does a large part
of TAL specification 1.4. We then came across the following problem:

 

Previously we were using a combination of PHP and Smarty to handle logic and
presentation layer. Smarty has a nifty little plugins architecture witch
allow for extensibility. You can for instance do something like this:

 

{$my_name|capitalize}

 

Which capitalize the value $my_name. We then thought: Hey, how will we do
stuff like that from now on? Every major implementation of TAL I've seen
allow for scripting calls like this:

 

<span tal:repeat="opt python:range(1,10)">

 

So I've decided to implement the something like this to handle string
capitalize:

 

<span tal:content="js:getCapitalizeValue(data['myname'])">

 

The getCapitalizeValue method could handle data formatting from the data
source (which can be in my case an associative array or an object). But this
manner fails to use the canonical path notation of TAL (data/myname)

 

My question is: Is TAL meant to support data formatting or only data
displaying? Could we for instance implement something like this:

 

<span tal:content=" /data/myname|capitalize">

 

I may be in a complete wrong track, but any suggestion or comments would be
greatly appreciated!

 

Cheers,

 

--

Dany Patrie

 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.zope.org/pipermail/zpt/attachments/20050526/5b009eda/attachment.htm


More information about the ZPT mailing list