[ZPT] tal replacements in javascript

Thomas Olsen thomas@iconmedialab.dk
Thu, 17 May 2001 21:54:18 +0200


Evan Simpson wrote:
> TAL doesn't look inside of script tags.  You could do this:
> 
> <script type="text/javascript" language="Javascript"
>   tal:content="string:var
> src='${here/image_status_subpath}${here/chatstatus}.gif';>
> var src='dummy.gif';
> </script>
> <script type="text/javascript" language="Javascript">
>     if(top.topFrame.document.images.status_light) {
>         top.topFrame.document.images.status_light.src = src;
>     }
> </script>
> 
> We're brainstorming ideas to make this better.

Thanks. It works fine but kinda kludgy if you need to initialize several
vars.
 
> > BTW: is there no way of joining conditions as in <p
> > tal:condition="(exists) /path/subpath; (exists) /path/othersubpath" /> ?
> 
> By 'join' do you mean boolean AND?  Only using a Python expression:
> 
> tal:define="c1 (exists) /path/subpath; c2 (exists) /path/othersubpath"
> tal:condition="python:c1 and c2"

Aha - problem solved! Now I think I'm gonna rest in the couch with a
copy of "Programming Python" :-)

-- 
Thomas Olsen
Programmer
Icon Medialab, Denmark
Havnegade 39, 3-5 sal.
DK-1058 Copenhagen K

Icon Office  :  +45 70 23 10 01
Icon Fax     :  +45 33 32 02 09
Email        :  thomas@iconmedialab.dk,tanghus@kde.org

http://www.iconmedialab.com - http://www.tanghus.dk

Do not meddle in the affairs of programmers, for they are easy to annoy,
and have all the source code!!!