Follow us on Twitter X-Cart on Facebook Wiki
Shopping cart software Solutions for online shops and malls
 

JavaScript in Templates

 
Reply
   X-Cart forums > X-Cart 4 > Dev Questions > Changing design
 
Thread Tools Search this Thread
  #1  
Old 09-19-2002, 01:47 PM
 
syddos syddos is offline
 

eXpert
  
Join Date: Sep 2002
Location: London, England, UK
Posts: 259
 

Default 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

Nothing is impossible, We just don't know how to do it ........Yet!

Xcart 4.1.X PRO (Testing Platform: winXP Pro)
Perl 5.8.7 (win32)
WINAMP 1.6.3 (win32 server package. Includes the following)
- phpMyAdmin v2.8.03
- MySql 5.0.21
- Apache 2.0.55 (win32)
- php 5.1.4
- SQLitemanager 1.2.0
Reply With Quote
  #2  
Old 09-19-2002, 03:57 PM
 
syddos syddos is offline
 

eXpert
  
Join Date: Sep 2002
Location: London, England, UK
Posts: 259
 

Default 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.
__________________
Syddos

Nothing is impossible, We just don't know how to do it ........Yet!

Xcart 4.1.X PRO (Testing Platform: winXP Pro)
Perl 5.8.7 (win32)
WINAMP 1.6.3 (win32 server package. Includes the following)
- phpMyAdmin v2.8.03
- MySql 5.0.21
- Apache 2.0.55 (win32)
- php 5.1.4
- SQLitemanager 1.2.0
Reply With Quote
  #3  
Old 09-19-2002, 06:39 PM
  B00MER's Avatar 
B00MER B00MER is offline
 

X-Guru
  
Join Date: Sep 2002
Location: Keller, TX (Cart-Lab.com)
Posts: 3,165
 

Default

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

http://smarty.php.net/manual/en/language.function.literal.html
__________________
Cart-Lab - 100+ Social Bookmarks for X-Cart.
Reply With Quote
Reply
   X-Cart forums > X-Cart 4 > Dev Questions > Changing design



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -8. The time now is 10:21 PM.

   

 
X-Cart forums © 2001-2020