![]() |
How do I add Javascript?
I want to create a menu that corresponds to the rest of my site inside of x-cart on in the header. Where do I put the script code for it to affect the info in head.tpl?
|
Re: How do I add Javascript?
You'd need to put JS in the <head> tag which is in customer/home.tpl. You also need to surround most JS with {literal} tags to work:
{literal} javascript here {/literal} |
Re: How do I add Javascript?
Awesome, worked great. Thanks!
|
Re: How do I add Javascript?
Adding the script to customer/home.tpl works for all pages (including https) except the cart pages. I can't find where to add the script so my Comodo corner logo appears throughout the checkout process.
|
Re: How do I add Javascript?
If you are using Fast lane Checkout they have their own set of templates in the Modules/Fast Lane folder.
|
Re: How do I add Javascript?
I thought I had this working and went to check it in IE and for some reason it doesn't work. Here is the link to my cart: http://remembermedisplay.com/order/home.php
I can't figure out why it would work fine in Firefox but not in IE. Any suggestions? |
Re: How do I add Javascript?
I need to add 2 javascript files, but not sure where to place them, where x-cart calls them, ect...
I'm using a dynamic drive scrolling marquee for the homepage only, so I'm placing the actual marquee code on that template, but what directory should I copy the two files? |
Re: How do I add Javascript?
It doesn't matter what directory you copy them to. You can create your own directory for them if you want to keep all your 3rd party scripts in a separate folder. You would just have to make sure that where it lists where your code is located, you set it to the directory that you have saved them in. It should look something like this:
Code:
<script language="javascript" src="<script type="text/javascript" src="highslide/highslide.js"></script>"> |
Re: How do I add Javascript?
GI: I have other JS all in one file (it's big), so I'd like to keep this one separate. So where does the code to direct go? what file? and if I have several different JS file, will I need to adjust that, or just place them all in the same directory?
|
Re: How do I add Javascript?
Think of it as similar to a CSS reference when you have an external style sheet. You put it in the <head> tags (usually I keep mine near the top to find it quickly). So if it's going into your cart you would be looking for the file skin1/customer/home.tpl. As far as I know there isn't a way to designate it only to the first page in x-cart so if you include it in there it will be loaded with every page of x-cart which shouldn't really matter because the function call is what actually references the file.
|
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?
|
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:
|
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.
|
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.
|
Re: How do I add Javascript?
Quote:
Those need to be in the <head> |
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... |
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.
|
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... :(
|
Re: How do I add Javascript?
Code from skin1_original/customer/home.tpl:
Quote:
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 |
Re: How do I add Javascript?
AHHH! home.tpl yes I see the head tags, will try it now...
|
Re: How do I add Javascript?
ok, pasted:
<HEAD> <script language="JavaScript" src="../scripts/dhtmllib.js"></script> <script language="JavaScript" src="../scripts/scroller.js"></script> </head> Still can't get the marquee to show. There is something in the code breaking the page. |
Re: How do I add Javascript?
does it give any errors or is it a totally blank page?
|
Re: How do I add Javascript?
everything coded after what I paste is gone. This includes the right side column.
|
Re: How do I add Javascript?
Oh! Totally forgot..... try this:
{literal} javascript here {/literal} You probably need to add those literal tags before and after your code. |
Re: How do I add Javascript?
Inserted the literal tag, still not working...I"m at a loss for what to do.
|
Re: How do I add Javascript?
Quote:
Here is the homepage.tpl {*-----BEGIN SCROLLING MARQUEE--------- <table width="100%"><tr> <td align="center"> <div id="tempholder"></div> <script language="JavaScript" src="dhtmllib.js"></script> <script language="JavaScript" src="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, 100, 1, 5); //(xpos, ypos, width, height, border, padding) myScroller1.setColors("#006699", "#FFFFFF", "#efefef"); //(fgcolor, bgcolor, bdcolor) myScroller1.setFont("Verdana,Arial,Helvetica", 2); myScroller1.addItem("<p align='center'><b>The all new Rip Curl E-Bombs are here!</b><br>E3: The third generation of Elastomax Superstretch Neoprene. Lighter, Warmer and More Flexible.</p>"); myScroller1.addItem("<p align='center'><b>Patagonia Wetsuits! Coming this fall!</b> <br>The arrival is quickly approaching┘ Cleanlinesurf is one of only 10 US authorized dealers. Check out the construction here.</p>"); myScroller1.addItem("<p align='center'><b>The all new F-Bombs are here!</b><br>Rip Curl F-Bomb Hooded Wetsuits with Fireskin lining! New and improved for Fall 08. Still the warmest available.</p>"); myScroller1.addItem("<p align='center'><b>On Sale Now:</b><br>• O'neill Hammer 3/2 - $99.96<br>• Billabong Foil GBS - $103.16<br>• Billabong Foil FL - $77.56</p>"); //SET SCROLLER PAUSE myScroller1.setPause(3000); //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:480; height:100px;"> -----END SCROLLING MARQUEE---------------------------*} <table width="100%" align="center"> <tr> <td align="center"><table width="400" border="0" cellspacing="0" cellpadding="0"> <tr> <td><a href="home.php?cat=2091"><img src="images/manufacture_01-nixon.jpg" width="133" height="66" border="0" alt="Nixon Watches" /></a></td> <td><a href="home.php?cat=614"><img src="images/manufacture_02-oneill.jpg" width="133" height="66" border="0" alt="Oneill Wetsuits" /></a></td> <td><a href="home.php?cat=2019"><img src="images/manufacture_21-future.gif" width="133" height="66" border="0" alt="Future Fins, surfboard, fins" /></a></td> </tr> <tr> <td> <a href="javascript:openNewWindow('http://www.patagonia.com/usa/popup/media_gallery_photo.jsp?OPTION=SAR&assetid=18490', 'thewin','height=530,width=600, toolbar=no,scrollbars=yes')"> <img src="images/manufacture_00-patagonia.jpg" alt="Patagonia Coming Soon!" width="133" height="66" border="0" /></a></td> <td><a href="home.php?cat=667"><img src="images/manufacture_05-ripcurl.jpg" width="133" height="66" border="0" alt="Rip Curl Wetsuits, Watches" /></a></td> <td><a href="home.php?cat=904"><img src="images/manufacture_06-gsi.jpg" width="133" height="66" border="0" alt="GSI, Global Surf Industries" /></a></td> </tr> <tr> <td><a href="home.php?cat=1864"><img src="images/manufacture_07-firewire.jpg" width="133" height="66" border="0" alt="Firewire Surfboards" /></a></td> <td><a href="home.php?cat=662"><img src="images/manufacture_08-quiksilver.jpg" width="133" height="66" border="0" alt="Quiksilver Wetsuits" /></a></td> <td><a href="home.php?cat=2020"><img src="images/manufacture_09-fcs.jpg" width="133" height="66" border="0" alt="FCS, Surfboard Fins" /></a></td> </tr> <tr> <td><a href="home.php?cat=1311"><img src="images/manufacture_10-billabong.jpg" width="133" height="66" border="0" alt="Billabong Wetsuits" /></a></td> <td><a href="home.php?cat=1029"><img src="images/manufacture_11-sector9.jpg" width="133" height="66" border="0" alt="Sector 9, Sector nine, skateboards, longboards" /></a></td> <td><a href="home.php?cat=1517"><img src="images/manufacture_12-arnette.jpg" width="133" height="66" border="0" alt="Arnette Sunglasses" /></a></td> </tr> <tr> <td><a href="home.php?cat=692"><img src="images/manufacture_13-roxy.jpg" width="133" height="66" border="0" alt="Roxy Women Wetsuits" /></a></td> <td><a href="home.php?cat=456"><img src="images/manufacture_14-vestal.jpg" width="133" height="66" border="0" alt="Vestal Watches" /></a></td> <td><a href="home.php?cat=1297"><img src="images/manufacture_15-dakine.jpg" width="133" height="66" border="0" alt="Dakine accessories" /></a></td> </tr> <tr> <td><a href="home.php?cat=2"><img src="images/manufacture_16-oakley.jpg" width="133" height="66" border="0" alt="Oakley Sunglasses" /></a></td> <td><a href="home.php?cat=1981"><img src="images/manufacture_17-arbor.jpg" width="133" height="66" border="0" alt="Arbor longboards, skateboards" /></a></td> <td><a href="home.php?cat=1661"><img src="images/manufacture_18-vonzipper.jpg" width="133" height="66" border="0" alt="Von zipper sunglasses" /></a></td> </tr> <tr> <td><a href="home.php?cat=1165"><img src="images/manufacture_04-spy.jpg" width="133" height="66" border="0" alt="Spy Sunglasses" /></a></td> <td><a href="home.php?cat=1024"><img src="images/manufacture_03-ugg.jpg" width="133" height="66" border="0" alt="UGG boots" /></a></td> <td><a href="home.php?cat=1980"><img src="images/manufacture_20-grain.gif" width="133" height="66" border="0" alt="Grain Surfboards" /></a></td> </tr> <tr> <td><a href="http://www.cleanlinesurf.com/manufacturers.php?manufacturerid=40"><img src="images/manufacture_22-burton.jpg" alt="Burton" width="133" height="66" border="0" /></a></td> <td><a href="https://www.cleanlinesurf.com/manufacturers.php?manufacturerid=46"><img src="images/manufacture_19-sitka.gif" width="133" height="66" border="0" alt="Sitka Clothing" /></a></td> <td><a href="https://www.cleanlinesurf.com/manufacturers.php?manufacturerid=14"><img src="images/manufacture_23-hotline.gif" width="133" height="66" border="0" alt="hotline wetsuits"/></a></td> </tr> </table></td> </tr> </table> <br /> <table width="100%" border="0" align="center" cellpadding="0" cellspacing="0"> <tr> <td background="{$ImagesDir}/newmenu_01.gif"><img src="images/space.gif" width="14" height="22" /></td> <td background="{$ImagesDir}/newmenu_02.gif"><img src="images/space.gif" width="4" /><font color="#990000">Welcome to Cleanlinesurf.com!</font></td> <td background="{$ImagesDir}/newmenu_03.gif"><img src="images/space.gif" width="14" height="22" /></td> </tr> <tr> <td background="{$ImagesDir}/newmenu_04.gif"><img src="images/space.gif" width="14" height="100%" /></td> <td>We are a full service surf shop located on the Northern Oregon Coast. Established in 1980 and locally owned and operated, Cleanline is The Northwest's "Original" Surf Shop. We carry the Northwest's largest selection of surfboards & wetsuits, as well as a wide selection of quality, cutting edge gear to suit your lifestyle. <p>Our goal is to provide you with the best shopping experience possible. Our friendly knowledgeable staff is here to serve you. If you are looking for something special that you don't see on our site, please give us a call: Toll Free at (888) 546-6176 or International at (503) 738-2061. Thanks for shopping at Cleanlinesurf.com!</p> <p align="justify"> </p> </td> <td background="{$ImagesDir}/newmenu_06.gif"><img src="images/space.gif" width="14" height="100%" /></td> </tr> <tr> <td background="{$ImagesDir}/newmenu_07.gif"><img src="images/space.gif" width="14" height="14" /></td> <td background="{$ImagesDir}/newmenu_08.gif"><img src="images/space.gif" width="100%" height="14" /></td> <td background="{$ImagesDir}/newmenu_09.gif"><img src="images/space.gif" width="14" height="14" /></td> </tr> </table> <table width="100%" border="0" cellspacing="0" cellpadding="5" align="center"> <tr> <td width="100%" align="center"></td> </tr> </table> |
Re: How do I add Javascript?
Ok so I'm going another direction to add this little scroller. Here's the code I've written:
{literal}<iframe src="../mikescroll/scrolling_marque.html" width="480" height="100" align="center" scrolling="no" frameborder="0"></iframe>{/literal} This includes my html file I made, that works correctly, but right now it loads up the customer index page. What is the correct way to point to my file? The file is located: skin1/customer/main/mikescroll/scrolling_marque.html Maybe I need to make a static page and call it? How would I write that using the code above? |
Re: How do I add Javascript?
So I'm able to make the scroller work on a static page, now how do I insert this static page into the index page? I don't want to use the include function, because it won't align where I want, so I'm thinking iframe, but my iframe code isn't pulling the correct page. I have literal brackets, still no go...
|
Re: How do I add Javascript?
Take a look at customer/main/welcome.tpl. It is what puts the "Welcome to..." at the start of the center section of the home page.... is that where you want your marquee?
|
Re: How do I add Javascript?
I want the marquee to be placed just below the "Welcome to..."
|
Re: How do I add Javascript?
This is my welcome.tpl I don't know how this will help me place the code...
{if ($active_modules.Greet_Visitor ne "") and ($smarty.cookies.GreetingCookie ne "") and $logout_user eq ''} <H3>{$lng.lbl_welcome_back}, {$smarty.cookies.GreetingCookie|replace:"\'":"'"} </H3> {else} <H3>{$lng.lbl_welcome_to} { $config.Company.company_name }</H3> <p>{/if} {*{$lng.txt_welcome}*}</p> <p>{include file="customer/main/homepage.tpl"} </p> <P> {if $active_modules.Bestsellers ne "" and $config.Modules.bestsellers_menu ne "Y"} {include file="modules/Bestsellers/bestsellers.tpl"} {/if} <P> {include file="customer/main/featured.tpl" f_products=$f_products} homepage.tpl is the page i need to modify, I already know that, I just can't figure out the correct code... |
Re: How do I add Javascript?
X-cart doesn't have a "homepage.tpl". If you want your marquee to be directly below "Welcome to..." or "Welcome back..." then either place your code, or insert an include (probably a better idea) in the area you have commented out ( {*{$lng.txt_welcome}*} ).
Also, there appears to be some formatting errors in your welcome.tpl. You have "open paragraph (<p>) statements without "close paragraph"statements, and 1 of these is within a "if" statement. Code:
{if ($active_modules.Greet_Visitor ne "") and ($smarty.cookies.GreetingCookie ne "") and $logout_user eq ''} |
Re: How do I add Javascript?
I actually do have a "homepage.tpl" It is what controls the center section of the customer side. (where "welcome to" starts) I don't know if it was written specifically for our cart, I guess maybe it was since you say that x-cart dosen't have this file by default.
Anyway, I finally got it to work. I had too many lines and spaces in the code. It was breaking the page, so I condensed all the JS down to have no extra empty lines between the code. This is what I placed at the very top of the file Quote:
|
Re: How do I add Javascript?
I would like to do an include, but I'm not sure what to save the file I'm going to include as. Can I just make it a html?
If I was to include it where you say, I think it will spread across the entire white section, and that's not what I want. I want to add a flash to go there. The marquee is where I want it right now. |
All times are GMT -8. The time now is 08:06 PM. |
Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.