Smarty vs. JavaScript
| From: | Alexander Skwar | Date: | Thu, 06 Sep 2001 16:00:16 +0000 |
| Subject: | Smarty vs. JavaScript | ||
| Groups: | php.smarty.general | ||
| Request: | Send a blank email to php-smarty-general+get-1437@lists.php.net to get a copy of this message | ||
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 | http://www.iso-top.de
iso-top.de - Die günstige Art an Linux Distributionen zu kommen
Uptime: 1 day 1 hour 3 minutes