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

javascript in templates

 
Reply
   X-Cart forums > X-Cart 4 > Dev Questions > Changing design
 
Thread Tools Search this Thread
  #1  
Old 08-29-2003, 11:44 AM
 
dr2web dr2web is offline
 

Newbie
  
Join Date: Aug 2003
Posts: 2
 

Default javascript in templates

I actually have 2 questions. First is it possible to implement javascript in the teplates, I plugged a script in and the entire page went blank. I cut it from a static page so I know that it works.

Second, where are the head tags located for the store?
__________________
.::Mike
Reply With Quote
  #2  
Old 08-29-2003, 12:29 PM
 
dr2web dr2web is offline
 

Newbie
  
Join Date: Aug 2003
Posts: 2
 

Default found the head tags

I found the head tags inside of home.tpl for each area...
__________________
.::Mike
Reply With Quote
  #3  
Old 08-29-2003, 12:30 PM
  groovico's Avatar 
groovico groovico is offline
 

X-Man
  
Join Date: Apr 2003
Location: Firetanksoftware.com
Posts: 2,326
 

Default

Yup, just make sure you wrap the javascript in

{literal}

javascript

{/literal}

tags so smarty doesn't break it.
__________________
Groovico

Used by X-carters the world over:
Marketing Manager Pro Bundle For X-cart
Featured Product Manager for X-cart
Feed manager pro for X-cart

http://www.firetanksoftware.com

Celebrating 7 Years of providing quality X-cart Add ons and X-cart Mods for x-cart 3.X to X-cart 4.4.X
Reply With Quote
  #4  
Old 10-07-2003, 03:10 AM
 
CForrester CForrester is offline
 

Advanced Member
  
Join Date: Jul 2003
Posts: 46
 

Default re: mouseover javascript in head.tpl.."literal" us

Hi , I'm trying to get a mouseover menu for an adult lingerie +toys site and after careful editing of the menu.js i thought it might work......but theres no mouseover.
Any ideas were I'm going wrong.

menu.js contents :-



var imagePairs = new Array();
var imagePairCount = 0;
var imageDir = "/images/";

function loadImagePair() { // expects four arguments: name, targetname, and on and off image file path/names.
imagePairs[imagePairCount] = new Object();
imagePairs[imagePairCount].name = loadImagePair.arguments[0];
imagePairs[imagePairCount].targetname = loadImagePair.arguments[1];
imagePairs[imagePairCount].imageOn = new Image();
imagePairs[imagePairCount].imageOn.src = imageDir + loadImagePair.arguments[2];
imagePairs[imagePairCount].imageOff = new Image();
imagePairs[imagePairCount].imageOff.src = imageDir + loadImagePair.arguments[3];
imagePairCount++;
}

function loadImages() {
// four arguments: name, targetname, and on and off image file path/names.

loadImagePair('Anal_Ecstasy', 'Anal_Ecstasy', 'analecstasy-button_on.jpg', 'analecstasy-button_off.jpg');
loadImagePair('Erotic_oils', 'Erotic_oils', 'eroticoils-button_on.jpg', 'eroticoils-button_off.jpg');
loadImagePair('Forhim', 'Forhim', 'forhim-button_on.jpg', 'forhim-button_off.jpg');
loadImagePair('Funandgames', 'Funandgames', 'funandgames-button_on.jpg', 'funandgames-button_off.jpg');
loadImagePair('Gayzone', 'Gayzone', 'gayzone-button_on.jpg', 'gayzone-button_off.jpg');
loadImagePair('LadiesPleasureZone', 'LadiesPleasureZone', 'lpz-button_on.jpg', 'lpz-button_off.jpg');
loadImagePair('Lingerie', 'Lingerie', 'lingerie-button_on.jpg', 'lingerie-button_off.jpg');
loadImagePair('LustforLatexandLeather', 'LustforLatexandLeather', 'lll-button_on.jpg', 'lll-button_off.jpg');
loadImagePair('Playmates', 'Playmates', 'playmates-button_on.jpg', 'playmates-button_off.jpg');
loadImagePair('RealFeelStrap-ons', 'RealFeelStrap-ons', 'realfeel-button_on.jpg', 'realfeel-button_off.jpg');
loadImagePair('StockingsandPanties', 'StockingsandPanties', 'stockings-button_on.jpg', 'stockings-button_off.jpg');
loadImagePair('Vibrators', 'Vibrators', 'vibrators-button_on.jpg', 'Vibrators-button_off.jpg');
loadImagePair('SpecialOffers', 'SpecialOffers', 'specialoffers-button_on.jpg', 'specialoffers-button_off.jpg');
}

function imgOn(imageName) {
var i;
window.status = imageName;
for (i=0; i<imagePairCount; i++) {
if (imagePairs[i].name == imageName) {
var cmdstr = "document." + imagePairs[i].targetname + ".src = imagePairs[i].imageOn.src";
eval(cmdstr);
}
}
}

function imgOff(imageName) {
var i;
window.status = imageName;
for (i=0; i<imagePairCount; i++) {
if (imagePairs[i].name == imageName) {
var cmdstr = "document." + imagePairs[i].targetname + ".src = imagePairs[i].imageOff.src";
eval(cmdstr);
}
}
}

the head.tpl has the menu.js attached to it in the same dir and the button images are in a "images" subdir within that dir. Should it be a full path to it e.g. htt://www....../xcart/skin1/images/ etc

Not too sure if i understand about this "literal" in the .js
Any help appreciated.
thanks
Reply With Quote
  #5  
Old 12-18-2003, 08:11 AM
 
western-merc western-merc is offline
 

Advanced Member
  
Join Date: Dec 2003
Location: Tacoma, WA
Posts: 43
 

Default

This is from the Smarty site:

Quote:
Literal tags allow a block of data to be taken literally, not being interpreted by the Smarty engine. This is handy for things like javascript sections, where there maybe curly braces and such things that would confuse the template parser. Anything within {literal}{/literal} tags is not interpreted, but displayed as-is.

It's just so the script doesn't get touched until the user's browser gets to it.
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 10:17 PM.

   

 
X-Cart forums © 2001-2020