[ZPT] variables and javascript

Charlie Clark charlie at begeistert.org
Fri Oct 10 11:57:02 EDT 2003


On 2003-10-10 at 17:42:28 [+0200], Mitch Pirtle wrote:
> > <a tal:attributes="src python:'%s/media/home.gif' 
> > %here.portal_url"></a> Should work assuming portal_url is available.
> 
> I have figured out how to do this for the attributes, but how do you mix 
> TAL statements with javascript function calls?

I assume you mean, how do you deal with the 's? You can just quote them 
with \' I don't know if """ works but it should be fine in any Python 
expression. Basically if I find TALES becoming a pain I turn to Python: for 
relief ;-)

so
string:MM_swapImage('image_home','','http://10.0.3.120:8080/development_site/media/home_over.gif',1);

becomes something like

python:'''MM_swapImage('image_home','','http://10.0.3.120:8080/development_site/media/home_over.gif',1);'''

at least, it's worth a try!

Charlie



More information about the ZPT mailing list