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)
-   -   {literal} or no {literal} with Javascript code? (https://forum.x-cart.com/showthread.php?t=24426)

imexhouse 08-28-2006 06:18 PM

{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

wjbrewer 08-28-2006 08:38 PM

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.

imexhouse 08-28-2006 09:35 PM

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.


All times are GMT -8. The time now is 01:13 AM.

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