X-Cart: shopping cart software

X-Cart forums (https://forum.x-cart.com/index.php)
-   Changing design (https://forum.x-cart.com/forumdisplay.php?f=51)
-   -   JavaScript in Templates (https://forum.x-cart.com/showthread.php?t=34)

syddos 09-19-2002 01:47 PM

JavaScript in Templates
 
Hi,

I would like to place a JavaScript script into the <HEAD> section of a page, I know "Smarty" will produce errors, if I just add it in the normal way (<script> <-- code --> </script>).

Is there a way to prevent smarty from producing errors, or should I create a JavaScript file (name.js) and call my script into the template page as an external file? Example below

<!--
<SCRIPT language=javascript1.4 src="http://www.stackofgoods.com/dir/myJavaScritpFile.js"></SCRIPT>
//-->

If anyone has another way Please let me know.

syddos 09-19-2002 03:57 PM

JavaScript in Templates - Solved
 
Problem solved. I used the method below between the <BODY> </BODY> tags of the template, to call my JavaScript file and run the script.

Quote:

<SCRIPT language=javascript src="http://www.stackofgoods.com/dir/myJavaScritpFile.js"></SCRIPT>

Thanks for looking.

B00MER 09-19-2002 06:39 PM

use {literal} {/literal} inside your javascript so that Smarty will not try and parse your javascript.

:arrow: http://smarty.php.net/manual/en/language.function.literal.html


All times are GMT -8. The time now is 03:58 PM.

Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2021, Jelsoft Enterprises Ltd.