|
Smarty
WARNING: All discussion is moving to https://reddit.com/r/smarty, please go there! This forum will be closing soon. |
|
View previous topic :: View next topic |
Author |
Message |
MisYu Smarty Rookie
Joined: 12 Sep 2004 Posts: 16
|
Posted: Thu Nov 18, 2004 9:49 am Post subject: Javascript codes |
|
|
You probably know that anyway, but let me write it down.
When including Javascript code inside the smarty template (not linking but including), don't forget not only about {literals}, but also that... you aren't supposed to use comments.
So this:
mytpl.tpl
----------
<html>
{debug}
<script language="Javascript" src="scripts.js"></script>
</html>
scripts.js
----------
/* this is a comment */
function something(){document.write('ble');}
is valid, but this:
mytpl.tpl
----------
<html>
{debug}
{literal}
<script language="Javascript">
/* this is a comment */
function something()
{document.write('ble');}
</script>
{/literal}
</html>
will make js not working, however after removing the comment it starts
worth mentioning? |
|
Back to top |
|
messju Administrator
Joined: 16 Apr 2003 Posts: 3336 Location: Oldenburg, Germany
|
Posted: Thu Nov 18, 2004 11:47 am Post subject: |
|
|
for me it works with and without the comment. no difference. |
|
Back to top |
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|