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

Running a little java script in static page

 
Reply
   X-Cart forums > X-Cart 4 > Dev Questions > Changing design
 
Thread Tools Search this Thread
  #1  
Old 02-12-2007, 03:42 PM
 
Paul H Paul H is offline
 

eXpert
  
Join Date: Sep 2005
Posts: 246
 

Default Running a little java script in static page

Hello
I'm back into my cart again and was putting some of my old html pages into the static pages
but the little calculation chart I have won't run and I guess that there is something in xcart that prevents this so need to know if there is a way around this or how can I put a simple link in the vert menu box which holds the static page links so it just opens up a new regular page outside the centre box- I thought of putting a link within the static page but prefer not to do this.
Thanks in A

Paul
__________________
Xcart Gold 4.1.11-Gone
= 4.7.11-Live
Reply With Quote
  #2  
Old 03-19-2007, 09:06 AM
 
balinor balinor is offline
 

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

Default Re: Running a little java script in static page

So you want all of your static page links to open in a new window?
__________________
Padraic Ryan
Ryan Design Studio
Professional E-Commerce Development
Reply With Quote
  #3  
Old 03-20-2007, 09:15 AM
 
Paul H Paul H is offline
 

eXpert
  
Join Date: Sep 2005
Posts: 246
 

Default Re: Running a little java script in static page

I'd like all my statics to open up in the centre panel but xcart won't allow java scripts.I even tried putting the link in the footer with some code that would open a new window without all the browser stuff and of a smaller size but this threw a smarty error. I read somewhere that it's not good website practice to have new pages opening up everywhere so trying to avoid this.Guess they are called static for a reason.
__________________
Xcart Gold 4.1.11-Gone
= 4.7.11-Live
Reply With Quote
  #4  
Old 03-20-2007, 09:17 AM
 
balinor balinor is offline
 

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

Default Re: Running a little java script in static page

X-Cart has no problem with JavaScript, you just need to call it correctly. By default, embedded static pages DO open in the center panel...not sure what you are trying to achieve?
__________________
Padraic Ryan
Ryan Design Studio
Professional E-Commerce Development
Reply With Quote
  #5  
Old 03-20-2007, 10:14 AM
 
Paul H Paul H is offline
 

eXpert
  
Join Date: Sep 2005
Posts: 246
 

Default Re: Running a little java script in static page

OK
Here's what I'm trying to acheive:

I'm trying to get my webpage with javascript to open up in the centre and still have the javascript working at the end of it.

I can't do it which is why I was asking the question here.

Here is the JS:

http://www.vwspeedshop.com/pg/Engine%20Calculator.htm
__________________
Xcart Gold 4.1.11-Gone
= 4.7.11-Live
Reply With Quote
  #6  
Old 03-20-2007, 10:15 AM
 
balinor balinor is offline
 

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

Default Re: Running a little java script in static page

You need to put the javascript in the <head> tag, which means you need to add it to customer/home.tpl. Then when you add the rest of the content to an embedded static page, it should show fine in the main area.
__________________
Padraic Ryan
Ryan Design Studio
Professional E-Commerce Development
Reply With Quote
  #7  
Old 03-20-2007, 10:25 AM
 
PhilJ PhilJ is offline
 

X-Guru
  
Join Date: Nov 2002
Posts: 4,094
 

Default Re: Running a little java script in static page

In General Settings, enable 'Parse Smarty tags in the content of embedded static pages'

Add this script to your static page...
Code:
{literal} <script language="javascript" type="text/javascript"> <!-- var win=null; function NewWindow(mypage,myname,w,h,scroll,pos){ if(pos=="random"){LeftPosition=(screen.width)?Math.floor(Math.random()*(screen.width-w)):100;TopPosition=(screen.height)?Math.floor(Math.random()*((screen.height-h)-75)):100;} if(pos=="center"){LeftPosition=(screen.width)?(screen.width-w)/2:100;TopPosition=(screen.height)?(screen.height-h)/2:100;} else if((pos!="center" && pos!="random") || pos==null){LeftPosition=0;TopPosition=20} settings='width='+w+',height='+h+',top='+TopPosition+',left='+LeftPosition+',scrollbars='+scroll+',location=no,directories=no,status=no,menubar=no,toolbar=no,resizable=no'; win=window.open(mypage,myname,settings);} // --> </script> {/literal}
Then add a link...
Code:
<a href="http://www.vwspeedshop.com/pg/Engine%20Calculator" onclick="NewWindow(this.href,'mywin','600','600','no','center');return false" onfocus="this.blur()">Engine Calculator</a>

Should do the job
__________________
xcartmods.co.uk
Reply With Quote
  #8  
Old 03-20-2007, 12:31 PM
 
Paul H Paul H is offline
 

eXpert
  
Join Date: Sep 2005
Posts: 246
 

Default Re: Running a little java script in static page

Ok
I tried that with some success.
When I click the link created by xcart in the lefthand column
it opens the centre section with another link and when clicked
produces a new window of given size but I have to have the page in a separate
folder outside of xcart-if I try putting anything in the embedded bit via admin/static pages
it causes all sorts of probs.
Now I'm going to try and add some code to the link on my footer so it opens a small simple page
__________________
Xcart Gold 4.1.11-Gone
= 4.7.11-Live
Reply With Quote
  #9  
Old 03-20-2007, 01:48 PM
 
Paul H Paul H is offline
 

eXpert
  
Join Date: Sep 2005
Posts: 246
 

Default Re: Running a little java script in static page

Well thanks guys.
I pasted Phils code into the customer/home file and the link code into the link in the footer
and it now works fine.
__________________
Xcart Gold 4.1.11-Gone
= 4.7.11-Live
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:22 AM.

   

 
X-Cart forums © 2001-2020