[Zope] Re: ZPT changing javascript (HOW?) - Easy with DTML

Florent Guillaume fg@nuxeo.com
Fri, 4 Oct 2002 14:58:20 +0000 (UTC)


Ah yes, that's a nice way to do it.

A not-so-nice way is to do:

<div tal:replace="string:&lt;script&gt;" />
... content of script tag including other calls to ZPT
<div tal:replace="string:&lt;/script&gt;" />

Florent

Evan Simpson  <evan@4-am.com> wrote:
> Mike Renfro wrote:
> > I'd be surprised if it parsed fine; if so, I was unaware that <span>
> > didn't require a </span> tag. How about replacing:
> 
> <script> and <style> elements contain text that is not parsed for tags. 
>   The only way to make this text dynamic is with tal:content, in either 
> of the two following ways:
> 
> <script tal:content="structure string:
>    var x = $x;
>    x = x + 1;
>    ...
> "></script>
> 
> <script tal:content="structure path/to/dtml_or_other_method"></script>
> 
> In other words, big honking string expression or another object that 
> generates the text.  Note that if all you're doing is setting up script 
> variables, you can split the script like so:
> 
> <script tal:content="structure string:
>    var x = $x;
>    var foo = ${template/id};
> "></script>
> <script>
>    x = x + 1;
>    ...etc...
> </script>
-- 
Florent Guillaume, Nuxeo (Paris, France)
+33 1 40 33 79 87  http://nuxeo.com  mailto:fg@nuxeo.com