Re: [phplib] Re: odd behaviour when parse()-ing a block From: Lazaro Ferreira (lazaro <email protected>)
Date: 06/05/01

Hi

I had this problem in the past, now I'm taking as much JS code as possible
out of the template, you can often wrap your JS code within custom functions
and then call them from the HTML code, so I link my JS modules into my html
page, and only left the JS calling code attached to my HTML template i.e:

in form events:
"onclick=my_function();"

or in HTML links:
"href=javascript:my_function();"

I know this is only a workaround, but I think it could help

Best regards
lazaro

----- Original Message -----
From: Dima Nemchenko <Dima.Nemchenko <email protected>>
Cc: < >
Sent: Tuesday, June 05, 2001 2:35 PM
Subject: Re: [phplib] Re: odd behaviour when parse()-ing a block

> Maxim Derkachev wrote:
>
> > Hello Dima,
> >
> > Tuesday, June 05, 2001, 3:34:00 PM, you wrote:
> >
> > DN> What is the recommended way to embed JavaScript in Templates?
> >
> > Just don't forget to leave spaces around the text between { and }.
> > E.g. if (a) {a=b;} within the template would cause a=b; interpreted as a
> > variable placeholder (which is obviously not the thing you expect).
> > But if (a) { a=b; } would be left untouched.
> > The same apply to CSS styles: { color:green } works, but {color:green}
> > does not.
> >
> > --
> > Best regards,
> > Maxim Derkachev mailto:max.derkachev <email protected>
>
> Privet Maxim,
>
>
> The JavaScript "{}" are going through the PHPLib parsing ok, it's the
> document.write() that is f-ing it up! What happens is that all sorts of
HTML
> codes like "&lt;" and "&nbsp;" get changed into plain ASCII, like "<" and
"
> ", but only in "appending" parse, and only if there was a parse with
> "document.write"
>
> Even putting just 'document.write()' on its own in the template stuffs it
> up!
>
>
> Thanks for you time, though,
> --
>
> :D_ima
> Dima Nemchenko <Dima.Nemchenko <email protected>>
>
> "Open source code is like lobster--most people who haven't tried it don't
> like the way it looks. But those who try it, love it."
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: phplib-unsubscribe <email protected>
> For additional commands, e-mail: phplib-help <email protected>
>
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: phplib-unsubscribe <email protected>
For additional commands, e-mail: phplib-help <email protected>