[ZPT] Tags not allowed inside script blocks?

Evan Simpson evan@digicool.com
Tue, 12 Jun 2001 15:46:13 -0400


Hamish Lawson wrote:

> I want to insert the value of a template variable into a JavaScript
> code block.


See http://dev.zope.org/Wikis/DevSite/Projects/ZPT/SearchAndReplace for 
a proposed way of doing this.  In the meantime, you have two choices:

1. Put the <script> body (or the entire tag) into a DTML Method, and use 
tal:content or tal:replace to dynamically insert it.

2. Set up the variables in a prior script tag, like this:

<script tal:content="string:var x='$foo';>
var x='foo';
</script>
<script>
<-- uses x -->
</script>

Cheers,

Evan @ digicool