[PHPTAL] JavaScript arrays using PHPTAL
Anton Andrievskij
x.meglio at gmail.com
Mon Jan 21 12:15:32 CET 2008
Ok, so the idea is to build data in the PHP, then simply past it to the
<script> using tal:content. Thanks.
On Jan 21, 2008 1:08 PM, Christoph Frick <frick at sc-networks.com> wrote:
> 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
>
> _______________________________________________
> PHPTAL mailing list
> PHPTAL at lists.motion-twin.com
> http://lists.motion-twin.com/mailman/listinfo/phptal
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.motion-twin.com/pipermail/phptal/attachments/20080121/d7d91fb3/attachment.htm
More information about the PHPTAL
mailing list