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

Pedro Beck Gomes da Costa pbeck@ciberbit.pt
Fri, 4 Oct 2002 16:10:50 +0100


Thanks, and thanks to all that answer to my original question.
It worked! I really have to practice more the zpt stuff :) were to much used
to DTML

Pedro Costa


----- Original Message -----
From: "Martijn Pieters" <mj@zope.com>
To: "Christopher N. Deckard" <cnd@ecn.purdue.edu>
Cc: "Mike Renfro" <renfro@tntech.edu>; <zope@zope.org>
Sent: Thursday, October 03, 2002 10:19 PM
Subject: Re: [Zope] ZPT changing javascript (HOW?) - Easy with DTML


> On Thu, Oct 03, 2002 at 02:46:54PM -0500, Christopher N. Deckard wrote:
> > <script tal:define="USER_NAME user/getUserName"
> >         type="text/javascript">
> > function connect()
> >   {
> >     username = <span tal:replace="USER_NAME">username</span>;
> >   }
> > </script>
> >
> > </body>
> > </html>
>
> Don't use tags within the script tag, the HTML spec specifically forbids
> that. I use the following construct for transferring Zope data into
> javascript variables, this is a real life example:
>
> <script type="text/javascript" tal:content="structure string:
>     portalURL = &quot;${here/portal_url}&quot;
>     editionURL = &quot;${here/absolute_url}&quot;
> " />
> <script type="text/javascript">
> // Your code goes here
> </script>
>
> The first script tag has its contents dictated by the tal:content
attribute.
> The second script tag has access to whatever you define in the context of
> the first, including the Zope data we just stuffed into there.
>
> Translating this to your specific case is left as an exercise. ;)
>
> --
> Martijn Pieters
> | Software Engineer  mailto:mj@zope.com
> | Zope Corporation   http://www.zope.com/
> | Creators of Zope   http://www.zope.org/
> ---------------------------------------------
>
> _______________________________________________
> Zope maillist  -  Zope@zope.org
> http://lists.zope.org/mailman/listinfo/zope
> **   No cross posts or HTML encoding!  **
> (Related lists -
>  http://lists.zope.org/mailman/listinfo/zope-announce
>  http://lists.zope.org/mailman/listinfo/zope-dev )
>

----- Original Message -----
From: "Martijn Pieters" <mj@zope.com>
To: "Christopher N. Deckard" <cnd@ecn.purdue.edu>
Cc: "Mike Renfro" <renfro@tntech.edu>; <zope@zope.org>
Sent: Thursday, October 03, 2002 10:19 PM
Subject: Re: [Zope] ZPT changing javascript (HOW?) - Easy with DTML


> On Thu, Oct 03, 2002 at 02:46:54PM -0500, Christopher N. Deckard wrote:
> > <script tal:define="USER_NAME user/getUserName"
> >         type="text/javascript">
> > function connect()
> >   {
> >     username = <span tal:replace="USER_NAME">username</span>;
> >   }
> > </script>
> >
> > </body>
> > </html>
>
> Don't use tags within the script tag, the HTML spec specifically forbids
> that. I use the following construct for transferring Zope data into
> javascript variables, this is a real life example:
>
> <script type="text/javascript" tal:content="structure string:
>     portalURL = &quot;${here/portal_url}&quot;
>     editionURL = &quot;${here/absolute_url}&quot;
> " />
> <script type="text/javascript">
> // Your code goes here
> </script>
>
> The first script tag has its contents dictated by the tal:content
attribute.
> The second script tag has access to whatever you define in the context of
> the first, including the Zope data we just stuffed into there.
>
> Translating this to your specific case is left as an exercise. ;)
>
> --
> Martijn Pieters
> | Software Engineer  mailto:mj@zope.com
> | Zope Corporation   http://www.zope.com/
> | Creators of Zope   http://www.zope.org/
> ---------------------------------------------
>
> _______________________________________________
> Zope maillist  -  Zope@zope.org
> http://lists.zope.org/mailman/listinfo/zope
> **   No cross posts or HTML encoding!  **
> (Related lists -
>  http://lists.zope.org/mailman/listinfo/zope-announce
>  http://lists.zope.org/mailman/listinfo/zope-dev )
>