Jump to content

Uncaught SyntaxError: Unexpected token )


tascam424

Recommended Posts

Hi folks, i'm trying desperately to convert an HTML template to a Smarty Template for WHMCS, everything is going fine except i can't get the Parallax Slider to function.

 

It works perfectly in the standard HTML Template but won't work in the Smarty Template, so i'm guessing some of the core WHMCS scripting must be conflicting.

 

The only thing i can see is          Uncaught SyntaxError: Unexpected token )    ultrawebtemplates.com/ :94

 

Lines 94 - 106 look like this 

<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
		<script type="text/javascript" src="templates/Custom/js/jquery.cslider.js"></script>
		<script type="text/javascript">
			$(function() {
			
				$('#da-slider').cslider({
					autoplay	: true,
					bgincrement	: 450
				});
			
			});
		</script>	

Off course if anybody would care to look you can see the live domain http://ultrawebtemplates.com

 

Greatly appreciate any help.

 

 

 

 

 

Link to comment
Share on other sites

Surround your script tags with smarty's {literal}...{/literal} tags What's happening is smarty is treating the { and } in the script as smarty tags and replacing them. If you view-source on your page you will see that the code is actually:

		<script type="text/javascript">
			$(function() );
			
			});
		</script>
Link to comment
Share on other sites

Have you ever been told how wonderful you are ?

 

Thank you so very much !!

 

Worked perfectly just by adding that to the little piece of script. Is it necessary to do that when calling a script library also ?

 

Like this <script type="text/javascript" src="templates/Custom/js/jquery.cslider.js"></script>

 

It wasn't required in this circumstance but it it best practice ?

 

Thank you again !!

Link to comment
Share on other sites

Is it necessary to do that when calling a script library also ?

No, the script tags importing external files do not contain any { } pairs so they are not affected by smarty. Neither are the external files referenced as they are not parsed by smarty.

 

Online inline scripts (or anywhere else you use { } pairs) needs to be wrapped in the literal tags.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.