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

Adding Roll Over images

 
Reply
   X-Cart forums > X-Cart 4 > Dev Questions > Changing design
 
Thread Tools Search this Thread
  #1  
Old 02-07-2006, 02:58 PM
 
dprice.sf dprice.sf is offline
 

Advanced Member
  
Join Date: May 2005
Posts: 66
 

Default Adding Roll Over images

Hi - I've got some product images i'll ideally have on the bottom of every page as roll overs.

I've edited my home.tpl file with the roll over images and included a newly created roll.js file to handle the js.

when i try and load the home page now - i get a smarty error

Fatal error: Smarty error: [in roll.js line 1]: syntax error: unrecognized tag 'var' (Smarty_Compiler.class.php, line 580) in /homepages/34/d145649509/htdocs/mikan/store/Smarty-2.6.9/Smarty.class.php on line 1088

anyone have any ideas on how best to incorporate js into pages?
__________________
Version 4.0.14
Reply With Quote
  #2  
Old 02-07-2006, 03:14 PM
 
balinor balinor is offline
 

Veteran
  
Join Date: Oct 2003
Location: Connecticut, USA
Posts: 30,253
 

Default

You need to surround the js with literal tags:

{literal}script here{/literal}
__________________
Padraic Ryan
Ryan Design Studio
Professional E-Commerce Development
Reply With Quote
  #3  
Old 02-07-2006, 03:30 PM
 
dprice.sf dprice.sf is offline
 

Advanced Member
  
Join Date: May 2005
Posts: 66
 

Default

like this

Code:
{literal} function MM_swapImgRestore() { var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc; } function MM_preloadImages() { var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array(); var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++) if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}} } function MM_findObj(n, d) { var p,i,x; if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) { d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);} if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n]; for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document); if(!x && d.getElementById) x=d.getElementById(n); return x; } function MM_swapImage() { var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3) if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];} } {/literal}
__________________
Version 4.0.14
Reply With Quote
  #4  
Old 02-07-2006, 03:33 PM
 
balinor balinor is offline
 

Veteran
  
Join Date: Oct 2003
Location: Connecticut, USA
Posts: 30,253
 

Default

No, it needs to surround the entire script, including the opening and closing javascript tags.
__________________
Padraic Ryan
Ryan Design Studio
Professional E-Commerce Development
Reply With Quote
  #5  
Old 02-07-2006, 03:34 PM
 
dprice.sf dprice.sf is offline
 

Advanced Member
  
Join Date: May 2005
Posts: 66
 

Default

or this

{literal}
{ include file="roll.js" }
{/literal}
__________________
Version 4.0.14
Reply With Quote
  #6  
Old 02-07-2006, 04:15 PM
 
dprice.sf dprice.sf is offline
 

Advanced Member
  
Join Date: May 2005
Posts: 66
 

Default

thanks balinor. I was able to figure it out.

found this site to be helpful as well

http://www.phpfreaks.com/smarty_manual/page/language.function.literal.html
__________________
Version 4.0.14
Reply With Quote
  #7  
Old 02-08-2006, 11:33 AM
 
dprice.sf dprice.sf is offline
 

Advanced Member
  
Join Date: May 2005
Posts: 66
 

Default

Is there a trick to getting the embedded static pages to use js ?

tried the same approach as discussed above - doesn't seem to work here though
__________________
Version 4.0.14
Reply With Quote
  #8  
Old 02-08-2006, 12:39 PM
 
balinor balinor is offline
 

Veteran
  
Join Date: Oct 2003
Location: Connecticut, USA
Posts: 30,253
 

Default

Check the 'allow smarty in static pages option.
__________________
Padraic Ryan
Ryan Design Studio
Professional E-Commerce Development
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 11:24 AM.

   

 
X-Cart forums © 2001-2020