Smarty Forum Index Smarty
WARNING: All discussion is moving to https://reddit.com/r/smarty, please go there! This forum will be closing soon.

Javascript codes

 
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Smarty Forum Index -> Tips and Tricks
View previous topic :: View next topic  
Author Message
MisYu
Smarty Rookie


Joined: 12 Sep 2004
Posts: 16

PostPosted: Thu Nov 18, 2004 9:49 am    Post subject: Javascript codes Reply with quote

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? Smile
Back to top
View user's profile Send private message Send e-mail
messju
Administrator


Joined: 16 Apr 2003
Posts: 3336
Location: Oldenburg, Germany

PostPosted: Thu Nov 18, 2004 11:47 am    Post subject: Reply with quote

for me it works with and without the comment. no difference.
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Display posts from previous:   
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Smarty Forum Index -> Tips and Tricks All times are GMT
Page 1 of 1

 
Jump to:  
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
Protected by Anti-Spam ACP