Page 1 of 1

Smarty Error with a javascript code

Posted: Wed May 25, 2011 2:43 pm
by Hoppo88
Hello all. I have just added some code to my CMS website that allows me to have a jquery image slider.

It works fine in a normal html document but when i add it to my cms template it get the following error:

string(132) "Smarty error: [in tpl_head:27 line 9]: syntax error: unrecognized tag: $('#featured').orbit(); (Smarty_Compiler.class.php, line 446)" string(110) "Smarty error: [in tpl_head:27 line 9]: syntax error: unrecognized tag '' (Smarty_Compiler.class.php, line 590)"

THe code im trying to implement is

Code: Select all

		<__script__ type="text/javascript">
			$(window).load(function() {
				$('#featured').orbit();
			});
		</__script>
Can anyone offer any help / advice on what i can do to solve this ?

Thanks in advance

Re: Smarty Error with a javascript code

Posted: Wed May 25, 2011 9:30 pm
by M@rtijn
You need to wrap the javascript in {literal} tags.

Code: Select all

{literal}
      <__script__ type="text/javascript">
         $(window).load(function() {
            $('#featured').orbit();
         });
      </__script>
{literal}