Smarty Error with a javascript code

The place to talk about things that are related to CMS Made simple, but don't fit anywhere else.
Post Reply
Hoppo88
New Member
New Member
Posts: 6
Joined: Fri Apr 15, 2011 10:42 pm

Smarty Error with a javascript code

Post 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
User avatar
M@rtijn
Power Poster
Power Poster
Posts: 706
Joined: Sat Nov 14, 2009 4:54 pm
Location: the Netherlands

Re: Smarty Error with a javascript code

Post 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}
Make your community a better place!
Post Reply

Return to “The Lounge”