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

How do I add Javascript?

 
Reply
   X-Cart forums > X-Cart 4 > Dev Questions > Changing design
 
Thread Tools Search this Thread
  #11  
Old 07-31-2008, 12:28 PM
  boomobile's Avatar 
boomobile boomobile is offline
 

eXpert
  
Join Date: Oct 2007
Posts: 306
 

Default Re: How do I add Javascript?

OK, so I tried to place it, but it breaks the code somewhere. I took out all extra spaces, and extra hard returns, but still won't display. It actually wipes out everything below that point. any suggestions?
__________________
X Cart Ver: 4.0.14
MySQL4 4.1.22
phpMyAdmin 2.6.0
Pearl 5.6.0
PHP 5.2.1
Python 2.2.2
Server: Apache/2.0.52 (Red Hat)
OS: Linux
www.cleanlinesurf.com
1. Customer Rewards Points
2. One Page Checkout (altercart)
3. Free shipping orders over $50 as Real Time Shipping
4. Gift Certificates
-----------------------------------------------
Graphic Design | Boomobile Design, LLC
www.boomobile.com
Reply With Quote
  #12  
Old 07-31-2008, 12:36 PM
  boomobile's Avatar 
boomobile boomobile is offline
 

eXpert
  
Join Date: Oct 2007
Posts: 306
 

Default Re: How do I add Javascript?

Ok, so I placed the js file in my "scripts" folder with the other js. Copied page code directly from dynamic drive and placed it in the correct area that I want the marquee to display, but it breaks the code somewhere and everything after the code is blank.

Quote:
<div id="tempholder"></div>
<script language="JavaScript" src="../scripts/dhtmllib.js"></script>
<script language="JavaScript" src="../scripts/scroller.js"></script>
<script language="JavaScript">

/*
Mike's DHTML scroller (By Mike Hall)
Last updated July 21st, 02' by Dynamic Drive for NS6 functionality
For this and 100's more DHTML scripts, visit http://www.dynamicdrive.com
*/

//SET SCROLLER APPEARANCE AND MESSAGES
var myScroller1 = new Scroller(0, 0, 480, 32, 1, 5); //(xpos, ypos, width, height, border, padding)
myScroller1.setColors("#006600", "#ccffcc", "#009900"); //(fgcolor, bgcolor, bdcolor)
myScroller1.setFont("Verdana,Arial,Helvetica", 2);
myScroller1.addItem("<b>Click here for <a href='http://dynamicdrive.com'>Dynamic Drive</a>, the net\'s #1 DHTML site!</b>");
myScroller1.addItem("<b>Visit <a href='http://www.brainjar.com'>Brain Jar</a>, Mike\'s great coding site!</b>");
myScroller1.addItem("<b>Looking for free JavaScripts? Visit <a href='http://javascriptkit.com'>JavaScript Kit.</a>");
myScroller1.addItem("<b>Discuss and get help on web coding, at <a href='http://www.codingforums.com'>CodingForums.com</a></b>");

//SET SCROLLER PAUSE
myScroller1.setPause(2500); //set pause beteen msgs, in milliseconds

function runmikescroll() {

var layer;
var mikex, mikey;

// Locate placeholder layer so we can use it to position the scrollers.

layer = getLayer("placeholder");
mikex = getPageLeft(layer);
mikey = getPageTop(layer);

// Create the first scroller and position it.

myScroller1.create();
myScroller1.hide();
myScroller1.moveTo(mikex, mikey);
myScroller1.setzIndex(100);
myScroller1.show();
}

window.onload=runmikescroll
</script>
<div id="placeholder" style="position:relative; width:420px; height:32px;"> </div>
-----END SCROLLING MARQUEE---------------------------*}
__________________
X Cart Ver: 4.0.14
MySQL4 4.1.22
phpMyAdmin 2.6.0
Pearl 5.6.0
PHP 5.2.1
Python 2.2.2
Server: Apache/2.0.52 (Red Hat)
OS: Linux
www.cleanlinesurf.com
1. Customer Rewards Points
2. One Page Checkout (altercart)
3. Free shipping orders over $50 as Real Time Shipping
4. Gift Certificates
-----------------------------------------------
Graphic Design | Boomobile Design, LLC
www.boomobile.com
Reply With Quote
  #13  
Old 07-31-2008, 12:40 PM
 
Group Imaging Group Imaging is offline
 

Advanced Member
  
Join Date: Oct 2007
Posts: 38
 

Default Re: How do I add Javascript?

Um, I think you may have this put in the wrong place? If that code is all within the <head> tags then you shouldn't have a <div> in there. If you have this in the <body> tags then you will need to move it before the </head> tag.
__________________
Brad Thompson
Group Imaging
X-Cart Gold Version 4.1.8
Reply With Quote
  #14  
Old 07-31-2008, 01:09 PM
  boomobile's Avatar 
boomobile boomobile is offline
 

eXpert
  
Join Date: Oct 2007
Posts: 306
 

Default Re: How do I add Javascript?

This is not in the head, this is the code for the actual marquee scroller. I can get it working just fine alone, but when I place it in the homepage.tpl it breaks the rest of the page.
__________________
X Cart Ver: 4.0.14
MySQL4 4.1.22
phpMyAdmin 2.6.0
Pearl 5.6.0
PHP 5.2.1
Python 2.2.2
Server: Apache/2.0.52 (Red Hat)
OS: Linux
www.cleanlinesurf.com
1. Customer Rewards Points
2. One Page Checkout (altercart)
3. Free shipping orders over $50 as Real Time Shipping
4. Gift Certificates
-----------------------------------------------
Graphic Design | Boomobile Design, LLC
www.boomobile.com
Reply With Quote
  #15  
Old 07-31-2008, 01:15 PM
 
Group Imaging Group Imaging is offline
 

Advanced Member
  
Join Date: Oct 2007
Posts: 38
 

Default Re: How do I add Javascript?

Quote:
<script language="JavaScript" src="../scripts/dhtmllib.js"></script>
<script language="JavaScript" src="../scripts/scroller.js"></script>

Those need to be in the <head>
__________________
Brad Thompson
Group Imaging
X-Cart Gold Version 4.1.8
Reply With Quote
  #16  
Old 07-31-2008, 01:30 PM
  boomobile's Avatar 
boomobile boomobile is offline
 

eXpert
  
Join Date: Oct 2007
Posts: 306
 

Default Re: How do I add Javascript?

hmmm, I don't have any other refrences to java in my head.tpl , any other suggestions?
What about my common_js.tpl ? would I copy the js files I have into this? There's got to be a way to refrence it...
__________________
X Cart Ver: 4.0.14
MySQL4 4.1.22
phpMyAdmin 2.6.0
Pearl 5.6.0
PHP 5.2.1
Python 2.2.2
Server: Apache/2.0.52 (Red Hat)
OS: Linux
www.cleanlinesurf.com
1. Customer Rewards Points
2. One Page Checkout (altercart)
3. Free shipping orders over $50 as Real Time Shipping
4. Gift Certificates
-----------------------------------------------
Graphic Design | Boomobile Design, LLC
www.boomobile.com
Reply With Quote
  #17  
Old 07-31-2008, 01:31 PM
 
Group Imaging Group Imaging is offline
 

Advanced Member
  
Join Date: Oct 2007
Posts: 38
 

Default Re: How do I add Javascript?

Sorry, it wouldn't be in head.tpl it would be in customer/home.tpl the head tags in there.
__________________
Brad Thompson
Group Imaging
X-Cart Gold Version 4.1.8
Reply With Quote
  #18  
Old 07-31-2008, 01:50 PM
  boomobile's Avatar 
boomobile boomobile is offline
 

eXpert
  
Join Date: Oct 2007
Posts: 306
 

Default Re: How do I add Javascript?

there aren't any head tags in any of my tpl files. I didn't create this shop, so I have no idea how things were modified. The person who did is of no help, he can't remember that far back...
__________________
X Cart Ver: 4.0.14
MySQL4 4.1.22
phpMyAdmin 2.6.0
Pearl 5.6.0
PHP 5.2.1
Python 2.2.2
Server: Apache/2.0.52 (Red Hat)
OS: Linux
www.cleanlinesurf.com
1. Customer Rewards Points
2. One Page Checkout (altercart)
3. Free shipping orders over $50 as Real Time Shipping
4. Gift Certificates
-----------------------------------------------
Graphic Design | Boomobile Design, LLC
www.boomobile.com
Reply With Quote
  #19  
Old 07-31-2008, 01:55 PM
 
Group Imaging Group Imaging is offline
 

Advanced Member
  
Join Date: Oct 2007
Posts: 38
 

Default Re: How do I add Javascript?

Code from skin1_original/customer/home.tpl:

Quote:
{* $Id: home.tpl,v 1.88.2.10 2007/06/18 12:38:57 max Exp $ *}
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
{if $printable ne ''}
{include file="customer/home_printable.tpl"}
{else}
{config_load file="$skin_config"}
<html>
<head>
<title>{strip}
{capture name=title}
{if $config.SEO.page_title_format eq "A"}
{section name=position loop=$location}
{if not %position.first%}&nbsp;::&nbsp;{/if}
{$location[position].0|strip_tags|escape}
{/section}
{else}
{section name=position loop=$location step=-1}
{if not %position.first%}&nbsp;::&nbsp;{/if}
{$location[position].0|strip_tags|escape}
{/section}
{/if}
{/capture}
{if $config.SEO.page_title_limit <= 0}
{$smarty.capture.title}
{else}
{$smarty.capture.title|replace:"&nbsp;":" "|truncate:$config.SEO.page_title_limit|replac e:" ":"&nbsp;"}
{/if}
{/strip}</title>
{include file="meta.tpl" }
<link rel="stylesheet" href="{$SkinDir}/{#CSSFile#}" />




</head>







<body{$reading_direction_tag}{if $body_onload ne ''} onload="javascript: {$body_onload}"{/if}>
{include file="rectangle_top.tpl" }
{include file="head.tpl" }
{if $active_modules.SnS_connector}
{include file="modules/SnS_connector/header.tpl"}
{/if}
<!-- main area -->
<table width="100%" cellpadding="0" cellspacing="0">
<tr>
<td class="VertMenuLeftColumn">
{if $categories ne "" and ($active_modules.Fancy_Categories ne "" or $config.General.root_categories eq "Y" or $subcategories ne "")}
{include file="customer/categories.tpl" }
<br />
{/if}
{if $active_modules.Bestsellers ne "" and $config.Bestsellers.bestsellers_menu eq "Y"}
{include file="modules/Bestsellers/menu_bestsellers.tpl" }
{/if}
{if $active_modules.Manufacturers ne "" and $config.Manufacturers.manufacturers_menu eq "Y"}
{include file="modules/Manufacturers/menu_manufacturers.tpl" }
{/if}
{include file="customer/special.tpl"}
{if $active_modules.Survey && $menu_surveys}
{foreach from=$menu_surveys item=menu_survey}
{include file="modules/Survey/menu_survey.tpl"}
<br />
{/foreach}
{/if}
{include file="help.tpl" }
<img src="{$ImagesDir}/spacer.gif" width="150" height="1" alt="" />
</td>
<td valign="top" width="100%">
<!-- central space -->
{include file="location.tpl"}

{if $gcheckout_enabled and $main ne "cart" and $main ne "checkout" and $main ne "anonymous_checkout" and $main ne "order_message"}
<div align="right">{include file="modules/Google_Checkout/gcheckout_button.tpl"}</div>
{/if}

{include file="dialog_message.tpl"}

{if $active_modules.Special_Offers ne ""}
{include file="modules/Special_Offers/customer/new_offers_message.tpl"}
{/if}

{include file="customer/home_main.tpl"}
<!-- /central space -->
&nbsp;
</td>
<td class="VertMenuRightColumn">
{if $active_modules.SnS_connector && $config.SnS_connector.sns_display_button eq 'Y' && $sns_collector_path_url ne ''}
{include file="modules/SnS_connector/button.tpl"}
<br />
{/if}
{if $active_modules.Feature_Comparison ne "" && $comparison_products ne ''}
{include file="modules/Feature_Comparison/product_list.tpl" }
<br />
{/if}
{include file="customer/menu_cart.tpl" }
<br />
{if $login eq "" }
{include file="auth.tpl" }
{else}
{include file="authbox.tpl" }
{/if}
{include file="news.tpl" }
{if $active_modules.XAffiliate ne "" && $config.XAffiliate.partner_register eq 'Y'}
<br />
{include file="partner/menu_affiliate.tpl" }
{/if}
{if $active_modules.Interneka ne ""}
<br />
{include file="modules/Interneka/menu_interneka.tpl" }
{/if}
<br />
{include file="poweredby.tpl" }
<br />
<img src="{$ImagesDir}/spacer.gif" width="150" height="1" alt="" />
</td>
</tr>
</table>
{include file="rectangle_bottom.tpl" }
{if $active_modules.Google_Analytics ne "" && $config.Google_Analytics.ganalytics_code ne ""}
{include file="modules/Google_Analytics/ga_code.tpl"}
{/if}
</body>
</html>
{/if}

That's how the original is so you can try using that if there's not too much of a difference in what they have in there now. All you should really need is the top part that I separated out. I purposely included a bunch of extra line breaks in the code so you could where I'm talking about easily.

But all of that said, you should just be able to include those 2 lines of js reference right above the </head> tag even if you just created your own <head></head> tags. If you still aren't sure maybe you could post the code from customer/home.tpl
__________________
Brad Thompson
Group Imaging
X-Cart Gold Version 4.1.8
Reply With Quote
  #20  
Old 07-31-2008, 02:12 PM
  boomobile's Avatar 
boomobile boomobile is offline
 

eXpert
  
Join Date: Oct 2007
Posts: 306
 

Default Re: How do I add Javascript?

AHHH! home.tpl yes I see the head tags, will try it now...
__________________
X Cart Ver: 4.0.14
MySQL4 4.1.22
phpMyAdmin 2.6.0
Pearl 5.6.0
PHP 5.2.1
Python 2.2.2
Server: Apache/2.0.52 (Red Hat)
OS: Linux
www.cleanlinesurf.com
1. Customer Rewards Points
2. One Page Checkout (altercart)
3. Free shipping orders over $50 as Real Time Shipping
4. Gift Certificates
-----------------------------------------------
Graphic Design | Boomobile Design, LLC
www.boomobile.com
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 01:13 PM.

   

 
X-Cart forums © 2001-2020