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

How to add statements to head section

 
Reply
   X-Cart forums > X-Cart 5 > Dev Questions (X-Cart 5)
 
Thread Tools Search this Thread
  #1  
Old 08-20-2014, 09:30 AM
 
JannieB JannieB is offline
 

Senior Member
  
Join Date: Sep 2004
Posts: 117
 

Question How to add statements to head section

Hi,
I need add some script statements to the Head section of the page so that i can can utilise typekit fonts....
pretty basic stuff but can't work out how to do it ...
can anyone help?
__________________
Jan Beesley
(Currently Xcart 5
Previously XCart Gold from 3.5....)
Reply With Quote
  #2  
Old 08-20-2014, 08:45 PM
  qualiteam's Avatar 
qualiteam qualiteam is offline
 

X-Guru
  
Join Date: Dec 2010
Posts: 6,373
 

Default Re: How to add statements to head section

Hello!

Is it X-Cart 4, or X-Cart 5?
__________________
Alex Solovev,
Qualiteam

---

User manual Video tutorials X-Cart FAQ

You are welcome to press "Thanks" button
if you find this post useful

Click here to learn how to apply patches

X-Cart Extensions
Reply With Quote
  #3  
Old 08-21-2014, 01:05 AM
 
JannieB JannieB is offline
 

Senior Member
  
Join Date: Sep 2004
Posts: 117
 

Default Re: How to add statements to head section

xcart 5.1.5

just trying to find my way around the new architecture ...

Also I will need to add some custom javascript as well. I don't want to edit the common.js can I add a new js.file

Jan
__________________
Jan Beesley
(Currently Xcart 5
Previously XCart Gold from 3.5....)
Reply With Quote
  #4  
Old 08-21-2014, 02:03 AM
 
JannieB JannieB is offline
 

Senior Member
  
Join Date: Sep 2004
Posts: 117
 

Default Re: How to add statements to head section

I have tried adding a tpl via custom skin in default/en/header/parts as follows:

Code:
{** * Head list children * * ... * * @ListChild (list="head", weight="700") *} <script type="text/javascript" src="//use.typekit.net/dap7cpb.js"></script> <script type="text/javascript">try{Typekit.load();}catch(e){}</script>

Then rebuilding the cache, but this just generates an internal error. If I comment out the script statements all is fine ....

How should I include these?

Jan
__________________
Jan Beesley
(Currently Xcart 5
Previously XCart Gold from 3.5....)
Reply With Quote
  #5  
Old 08-21-2014, 11:15 PM
  qualiteam's Avatar 
qualiteam qualiteam is offline
 

X-Guru
  
Join Date: Dec 2010
Posts: 6,373
 

Default Re: How to add statements to head section

Hello Jan,

This is because the templater finds "{" and "}" and decides that it is an instruction to him that he doesn't know.

Try this:

Code:
{** * Head list children * * ... * * @ListChild (list="head", weight="700") *} <script type="text/javascript" src="//use.typekit.net/dap7cpb.js"></script> <script type="text/javascript"><!--try{Typekit.load();}catch(e){}--></script>


Does this help?

A better way would be decorating the getJSFiles() method in the \XLite\View\Controller widget and adding a new JavaScript file that does the job on the page load.
__________________
Alex Solovev,
Qualiteam

---

User manual Video tutorials X-Cart FAQ

You are welcome to press "Thanks" button
if you find this post useful

Click here to learn how to apply patches

X-Cart Extensions

Last edited by qualiteam : 08-21-2014 at 11:22 PM.
Reply With Quote
  #6  
Old 08-22-2014, 12:55 AM
 
JannieB JannieB is offline
 

Senior Member
  
Join Date: Sep 2004
Posts: 117
 

Default Re: How to add statements to head section

Thanks Alex,

This did the trick but could you explain how I would go about using the other method, as I will have other javascript to add and would prefer to do it properly!

I have another question about removing the sidebars ..... but I will start a separate thread for that!

Jan
__________________
Jan Beesley
(Currently Xcart 5
Previously XCart Gold from 3.5....)
Reply With Quote
  #7  
Old 08-22-2014, 04:55 AM
  tony_sologubov's Avatar 
tony_sologubov tony_sologubov is offline
 

X-Cart team
  
Join Date: Jan 2009
Posts: 2,431
 

Default Re: How to add statements to head section

Hi Jan!

There is a guide how you can attach JS file to your module:
http://kb.x-cart.com/display/XDD/Adding+CSS+and+JS+files

You can simply use Custom Skin module in order to apply this change.
__________________
Found a bug in X-Cart? Post it to our bug tracker!
Know how to make X-Cart better? Suggest an idea!
Reply With Quote

The following user thanks tony_sologubov for this useful post:
JannieB (08-22-2014)
  #8  
Old 08-22-2014, 05:34 AM
 
JannieB JannieB is offline
 

Senior Member
  
Join Date: Sep 2004
Posts: 117
 

Default Re: How to add statements to head section

Thanks I have implemented it that way now .... much better!

Jan
__________________
Jan Beesley
(Currently Xcart 5
Previously XCart Gold from 3.5....)
Reply With Quote
Reply
   X-Cart forums > X-Cart 5 > Dev Questions (X-Cart 5)



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may 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 08:11 PM.

   

 
X-Cart forums © 2001-2020