Re: [PHPTAL] JavaScript arrays using PHPTAL

2008-01-21 Thread Levi Stanley
You can do something like this:

script language=javascript tal:content=structure
your-javascript-here-or-the-variable
/script

Best regards,
Levi

On Jan 21, 2008 5:43 AM, Anton Andrievskij [EMAIL PROTECTED] wrote:

 Hi.

 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?

 Thanks,
 Anton

 ___
 PHPTAL mailing list
 PHPTAL@lists.motion-twin.com
 http://lists.motion-twin.com/mailman/listinfo/phptal


___
PHPTAL mailing list
PHPTAL@lists.motion-twin.com
http://lists.motion-twin.com/mailman/listinfo/phptal


Re: [PHPTAL] JavaScript arrays using PHPTAL

2008-01-21 Thread Christoph Frick
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


pgpFbuPWUJM7f.pgp
Description: PGP signature
___
PHPTAL mailing list
PHPTAL@lists.motion-twin.com
http://lists.motion-twin.com/mailman/listinfo/phptal


Re: [PHPTAL] JavaScript arrays using PHPTAL

2008-01-21 Thread Anton Andrievskij
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 [EMAIL PROTECTED] 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@lists.motion-twin.com
 http://lists.motion-twin.com/mailman/listinfo/phptal


___
PHPTAL mailing list
PHPTAL@lists.motion-twin.com
http://lists.motion-twin.com/mailman/listinfo/phptal