[PHPTAL] JavaScript arrays using PHPTAL
Christoph Frick
frick at sc-networks.com
Mon Jan 21 12:08:14 CET 2008
On Mon, Jan 21, 2008 at 12:43:21PM +0200, Anton Andrievskij wrote:
> I have to fill JavaScript array using PHPTAL attributes.
>
> Whether I can use some <span ...tal-attributes here..></span> inside
> <script></script> construction?
>
> Example:
>
> <script language="JavaScript">
> items = array(
> <span ..PHPTAL loop here...>
> <span tal:replace ...writing item values to fill JavaScript
> array...></span>
> </span>
> )
> </script>
>
>
> If I can't do so, have you any idea about how to do it?
you can do so. but IE can not cope with trailing ``,``; so you have to
add something like:
<span tal:condition="not:repeat/item/end">, </span>
and beside that: why not write method, that returns the data directly?
or a phptal_tales_something "formatter"?
--
cu
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 163 bytes
Desc: not available
Url : http://lists.motion-twin.com/pipermail/phptal/attachments/20080121/a8c6dc7a/attachment.pgp
More information about the PHPTAL
mailing list