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

{literal} or no {literal} with Javascript code?

 
Reply
   X-Cart forums > X-Cart 4 > Dev Questions > Changing design
 
Thread Tools Search this Thread
  #1  
Old 08-28-2006, 06:18 PM
  imexhouse's Avatar 
imexhouse imexhouse is offline
 

eXpert
  
Join Date: May 2006
Location: Canada
Posts: 377
 

Default {literal} or no {literal} with Javascript code?

For the past three months, I've had a StatCounter code placed within my home.tpl, like this:
Code:
....home.tpl code...... { include file="modules/Interneka/menu_interneka.tpl" } {/if} <BR> { include file="poweredby.tpl" } <BR> <IMG src="{$ImagesDir}/spacer.gif" width="150" height="1" border="0"> </TD> <TD width="6">&nbsp;</TD> </TR> </TABLE> <br> <div align="center"> <!-- Start of StatCounter Code --> <script type="text/javascript" language="javascript"> ...and the rest of it....
The funny thing is, there have been no {literal}{/literal} tags placed around the javascript code and I've been getting statistics just the same. Every page visited by my customers has been recorded, with every detail.
How do you explain it, if every forum I go to, I read that in order for the javascript to work inside a .tpl file, you must surround it with {literal}{/literal} tags.

Tonight, I placed those tags around my javascript, and the stats I'm getting don't differ from the ones from yesterday, a week ago, and two months ago.
It seems to me those tags are optional, at least in my case...

I woul really like to have an explanation for this behaviour - or did I miss something?

Thanks,

Jack
__________________
Jack@AquasanaCA
X-CART GOLD 4.0.19 Live
DSEFU, AOM, ezCheckout, ezUpsell, ezRecommends, RememberMe, RememberAnonCarts
AquasanaCanada.com - Aquasana╝ - #1 Rated Water Filters in America!
X-CART GOLD 4.4.5 Live
CDSEO Pro v. 1.8.4
AquasanaMontreal.com
Aquasana╝ & Rhino Water Filtration Systems
Reply With Quote
  #2  
Old 08-28-2006, 08:38 PM
  wjbrewer's Avatar 
wjbrewer wjbrewer is offline
Banned
 

X-Adept
  
Join Date: Feb 2005
Location: Pittsburgh, PA
Posts: 504
 

Default Re: {literal} or no {literal} with Javascript code?

You don't technically need it around all JavaScript. Just JavaScript that has brackets {} that will interfere the Smarty parsing engine. However, most code does have {}, so you generally need the {literal} tags.
Reply With Quote
  #3  
Old 08-28-2006, 09:35 PM
  imexhouse's Avatar 
imexhouse imexhouse is offline
 

eXpert
  
Join Date: May 2006
Location: Canada
Posts: 377
 

Default Re: {literal} or no {literal} with Javascript code?

That makes sense, as the StatCounter code snippet doesn't have the {} braces.
Thanks for the explanation.
__________________
Jack@AquasanaCA
X-CART GOLD 4.0.19 Live
DSEFU, AOM, ezCheckout, ezUpsell, ezRecommends, RememberMe, RememberAnonCarts
AquasanaCanada.com - Aquasana╝ - #1 Rated Water Filters in America!
X-CART GOLD 4.4.5 Live
CDSEO Pro v. 1.8.4
AquasanaMontreal.com
Aquasana╝ & Rhino Water Filtration Systems
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 03:32 PM.

   

 
X-Cart forums © 2001-2020