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

Help please (Dreamweaver javascript problemo)

 
Reply
   X-Cart forums > X-Cart 4 > Dev Questions > Changing design
 
Thread Tools Search this Thread
  #1  
Old 06-02-2003, 10:14 PM
 
fearthespear fearthespear is offline
 

Senior Member
  
Join Date: Apr 2003
Posts: 124
 

Default Help please (Dreamweaver javascript problemo)

Hi,

I took customer home.tpl code and pasted it into Dreamweaver MX. I could visibly see the table layout in dreamweaver and I added my own tables and rows and insterted an image with swap image behaviour, I then took the code and pasted it back in xcart but I get errors.

Can someone please explain what is going on?

Thank you
Reply With Quote
  #2  
Old 06-03-2003, 02:47 AM
  shan's Avatar 
shan shan is offline
 

X-Guru
  
Join Date: Sep 2002
Location: Birmingham, UK
Posts: 6,163
 

Default

probably the javascript.

search for "literal"
__________________
Looking for a reliable X-cart host ?
You wont go wrong with either of these.

EWD Hosting
Hands On Hosting
Reply With Quote
  #3  
Old 06-03-2003, 09:13 AM
 
fearthespear fearthespear is offline
 

Senior Member
  
Join Date: Apr 2003
Posts: 124
 

Default literal

Hi this is my code BEFORE adding literal tags:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
{* $Id: home.tpl,v 1.42 2002/10/22 10:27:05 olga Exp $ *}
{ config_load file="$skin_config" }
<html>
<head>
<title>{$lng.txt_site_title}
{if $main eq "catalog"}
{if $location eq ""} {$lng.txt_subtitle_home}
{else}
{strip}
{section name=position loop=$location start=0 }
{if %position.last% eq "true"} - {$location[position].0|escape}{/if}
{/section}
{/strip}
{/if}
{elseif $main eq "product"}
{if $product.product ne ''} - {$product.product}{/if}
{elseif $main eq "help"}
{$lng.txt_subtitle_help}
{elseif $main eq "cart"}
{$lng.txt_subtitle_cart}
{elseif $main eq "checkout"}
{$lng.txt_subtitle_checkout}
{elseif $main eq "order_message"}
{$lng.txt_subtitle_thankyou}
{/if}
</title>
<script language="JavaScript" type="text/JavaScript">
<!--
function MM_preloadImages() { //v3.0
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_swapImgRestore() { //v3.0
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_findObj(n, d) { //v4.01
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() { //v3.0
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];}
}
//-->
</script>

<body onLoad="MM_preloadImages('%7B$ImagesDir%7D/missy.jpg')">
{ include file="meta.tpl" }
<link rel="stylesheet" href="{$SkinDir}/{#CSSFile#}">
</head>
<body LEFTMARGIN=0 TOPMARGIN=0 RIGHTMARGIN=0 BOTTOMMARGIN=0 MARGINWIDTH=0 MARGINHEIGHT=0>
{ include file="rectangle_top.tpl" }
{* { include file="head.tpl" } *}

<table border=0 width=100% cellpadding=0 cellspacing=0 align="center">
<tr>
<td class=VertMenuBox></td>
<td colspan="3" valign=top class=VertMenuBox>[img]{$ImagesDir}/missy2.jpg[/img]</td>
<td></td>
<td valign=top></td>
</tr>
<tr>
<td class=VertMenuBox width=6></td>
<td class=VertMenuBox width=150 valign=top> { include file="customer/categories.tpl"
} {if $active_modules.Bestsellers ne "" and $config.Modules.bestsellers_menu
eq "Y"} { include file="modules/Bestsellers/menu_bestsellers.tpl" } {/if}
{if $active_modules.Gift_Certificates ne ""}

{ include file="modules/Gift_Certificates/gc_menu.tpl" } {/if}

{ include file="help.tpl" } </td>
<td width=20></td>
<td valign=top>

{include file="customer/home_main.tpl"}

</td>
<td width=20></td>
<td width=150 valign=top> { include file="customer/menu_cart.tpl" } {if $login
eq "" } { include file="auth.tpl" } {else} { include file="authbox.tpl"
} {/if} { include file="news.tpl" }

{ include file="poweredby.tpl" } </td>
</tr>
<tr>
<td class=VertMenuBox></td>
<td class=VertMenuBox></td>
<td></td>
<td>{ include file="copyright.tpl" }</td>
<td></td>
<td></td>
</tr>
</table>
{ include file="rectangle_bottom.tpl" }
</body>
</html>
Reply With Quote
  #4  
Old 06-03-2003, 09:15 AM
 
fearthespear fearthespear is offline
 

Senior Member
  
Join Date: Apr 2003
Posts: 124
 

Default

this is my after:


<script language="JavaScript" type="text/JavaScript">
<!--
function MM_preloadImages() {literal} //v3.0
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];}}
{/literal}

function MM_swapImgRestore() {literal}//v3.0
var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
{/literal}

function MM_findObj(n, d) {literal} //v4.01
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;
{/literal}

function MM_swapImage() {literal} //v3.0
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}
//-->
</script>
Reply With Quote
  #5  
Old 06-03-2003, 09:18 AM
 
fearthespear fearthespear is offline
 

Senior Member
  
Join Date: Apr 2003
Posts: 124
 

Default hi

I dont get any errors but my swap image behaviour does not work.

....
Reply With Quote
  #6  
Old 06-03-2003, 09:38 AM
  shan's Avatar 
shan shan is offline
 

X-Guru
  
Join Date: Sep 2002
Location: Birmingham, UK
Posts: 6,163
 

Default

Try

Code:
{literal} <script language="JavaScript" type="text/JavaScript"> <!-- function MM_preloadImages() { //v3.0 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_swapImgRestore() { //v3.0 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_findObj(n, d) { //v4.01 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() { //v3.0 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];} } //--> </script> {/literal}
__________________
Looking for a reliable X-cart host ?
You wont go wrong with either of these.

EWD Hosting
Hands On Hosting
Reply With Quote
  #7  
Old 06-03-2003, 09:54 AM
 
fearthespear fearthespear is offline
 

Senior Member
  
Join Date: Apr 2003
Posts: 124
 

Default shan

Shan,

thank you sir. The image now swaps but it swaps to a red x . I have both of my images in the skin1/images folder so why is it not swapping to the correct image?
Reply With Quote
  #8  
Old 06-03-2003, 09:59 AM
  shan's Avatar 
shan shan is offline
 

X-Guru
  
Join Date: Sep 2002
Location: Birmingham, UK
Posts: 6,163
 

Default

not sure,

get it working in a normal page then add the code to the xcart page and remember to wrap the entire javascript bit in literal tags.

sounds like it cant find the rollover image. must be looking in the wrong place
__________________
Looking for a reliable X-cart host ?
You wont go wrong with either of these.

EWD Hosting
Hands On Hosting
Reply With Quote
  #9  
Old 06-03-2003, 10:15 AM
 
fearthespear fearthespear is offline
 

Senior Member
  
Join Date: Apr 2003
Posts: 124
 

Default ...

shan,

I have it working locally on my computer then I upload the code and add {$ImagesDir} in front of the pictures like I'm supposed to.

The image is there but it doesn't swap, I don't understand how it cannot find the image even if I add {$ImagesDir} in front of the image to swap or even skin1/images/ in front of it.
Reply With Quote
  #10  
Old 06-03-2003, 11:31 AM
 
fearthespear fearthespear is offline
 

Senior Member
  
Join Date: Apr 2003
Posts: 124
 

Default

Thank you Shan,

I got it to work!
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 07:21 AM.

   

 
X-Cart forums © 2001-2020