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

Need to add JS to <head> tag

 
Reply
   X-Cart forums > X-Cart 4 > Dev Questions > Changing design
 
Thread Tools Search this Thread
  #1  
Old 08-30-2011, 02:38 PM
 
rosenzweig70 rosenzweig70 is offline
 

Member
  
Join Date: Aug 2011
Posts: 18
 

Default Need to add JS to <head> tag

I'd like to add this to my <head> tag for all pages...

<script type="text/javascript" src="http://mysite.com/custom.js"></script>
<link rel="stylesheet" type="text/css" media="screen" href="http://mysite.com/custom.css" />

I've been searching this forum for well over an hour and I just can't seem to find success. I thought I had it when I found out about common_files/meta.tpl. I've been trying to alter that file, but the changes I'm making don't seem to be showing up.

Anyone lend a hand? Many thanks!
__________________
4.4.2
Reply With Quote
  #2  
Old 08-30-2011, 05:43 PM
  cflsystems's Avatar 
cflsystems cflsystems is offline
 

Veteran
  
Join Date: Apr 2007
Posts: 14,110
 

Default Re: Need to add JS to <head> tag

You can add to skin/your_skin/customer/service_head.tpl, if that file doesn't exist in your skin then common_files
__________________
Steve Stoyanov
CFLSystems.com
Web Development
Reply With Quote

The following user thanks cflsystems for this useful post:
SamuraiCoder (10-12-2011)
  #3  
Old 08-31-2011, 09:01 AM
 
rosenzweig70 rosenzweig70 is offline
 

Member
  
Join Date: Aug 2011
Posts: 18
 

Default Re: Need to add JS to <head> tag

Thanks! That helped a lot. I've found service_head.tpl file (under skin/common_files/customer/) and I can definitely see that's where this business is done.

My problem now is actually loading the files properly. I don't think I quite understand the syntax of the X-Cart short code language.

In order to pull in this file as I normally would...

<link rel="stylesheet" type="text/css" media="screen" href="http://mysite.com/custom.css" />

... do I need to put brackets around the statement? Or is it necessary to phrase it like this...

{load_defer file="http://mysite.com/custom.css" type="css"}

?

Actually there's not that much code in my css file -- could I just insert some CSS straight into service_head.tpl? If so how would that be formatted?

Thanks again for sharing your expertise and suffering through my newbness!
__________________
4.4.2
Reply With Quote
  #4  
Old 08-31-2011, 09:31 AM
  cflsystems's Avatar 
cflsystems cflsystems is offline
 

Veteran
  
Join Date: Apr 2007
Posts: 14,110
 

Default Re: Need to add JS to <head> tag

You can insert them as you have them in the first post or using the load_defer, either way will work. Use relative paths though
__________________
Steve Stoyanov
CFLSystems.com
Web Development
Reply With Quote
  #5  
Old 08-31-2011, 10:08 AM
 
rosenzweig70 rosenzweig70 is offline
 

Member
  
Join Date: Aug 2011
Posts: 18
 

Default Re: Need to add JS to <head> tag

Indeed!! All done. Thanks again Steve.
__________________
4.4.2
Reply With Quote
Reply
   X-Cart forums > X-Cart 4 > Dev Questions > Changing design


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 05:09 PM.

   

 
X-Cart forums © 2001-2020