Re: Smarty vs. JavaScript
| From: | Monte Ohrt | Date: | Thu, 06 Sep 2001 16:06:45 +0000 |
| Subject: | Re: Smarty vs. JavaScript | ||
| References: | 1 | Groups: | php.smarty.general |
| Request: | Send a blank email to php-smarty-general+get-1440@lists.php.net to get a copy of this message | ||
oops, the FAQ online isn't up to date with the FAQ in the distribution.
Here is the FAQ excerpt:
Q: Javascript is causing Smarty errors in my templates.
A: Surround your javascript with {literal}{/literal} tags. See the docs.
Alexander Skwar wrote:
>
> Hi!
>
> I'm having some problem with the current smarty snapshot and JavaScript.
> In my template, I've got:
>
> [...]
> <script language="JavaScript">
> <!--
> function Foo(){
> document.write('blah');
> }
> -->
> </script>
> [...]
>
> Now, when I load this template, Smarty bombs out with a error message
> like "Unknown tag document". This is because Smarty thinks it found
> "{document" in the template and is thus looking for the function called
> "document". Since there's no such function in Smarty, the error message
> shows up.
>
> I tried to fix this myself in Smarty_compiler, but wasn't able to :(
> What I wanted to change was, that Smarty doesn't look for a tag if
> there's none on the same line. In this case, it should ignore the
> opening left_delimeter { and pass it on to the client.
>
> Another fix would be to have a "function" which causes Smarty to ignore
> everything between the functions opening and end tag. Maybe so:
>
> function Foo(){as_is}{{/asis}
> document.write('blah');
> }
>
> Now, I could change left_delim to something else. But this would mean
> that I had to fix up all my templates, which, well, wouldn't be so nice
> :)
>
> How do you do stuff like this?
>
> Cheers,
>
> Alexander Skwar
> --
> How to quote: http://learn.to/quote (german)
> http://quote.6x.to (english)
> Homepage: http://www.digitalprojects.com | Y
> F*6ãUfãñmÇ
Vhttp://www.iso-top.de
> iso-top.de - Die günstige Art an Linux Distributionen zu kommen
> Uptime: 1 day 1 hour 3 minutes
>
> ---
> You are currently subscribed to smarty as: monte@ispi.net
> To unsubscribe send a blank email to $subst('Email.Unsub')
> Visit Smarty's homepage at
> http://www.phpinsider.com/php/code/Smarty/
--
Monte Ohrt <monte@ispi.net>
http://www.ispi.net/