X-Cart: shopping cart software

X-Cart forums (https://forum.x-cart.com/index.php)
-   Dev Questions (https://forum.x-cart.com/forumdisplay.php?f=20)
-   -   How to add CSS to <Head></Head> (https://forum.x-cart.com/showthread.php?t=73880)

cocopops 04-23-2016 12:27 AM

How to add CSS to <Head></Head>
 
Hi,

A lot of 3rd party jQuery/Javascript plug-ins require you to put a line of code in between the <head> </head> tags.

For example, I have a 3rd party Google Maps Plugin that I want to use in a Static Page. It requires me to put the line:
<link rel="stylesheet" type="text/css" href="revolution/css/layers.css">

in between the <head> </head> tags.

My question: Where is the <head> </head> tag located?
Is there a specific template file for static pages where I can find the <head></head> tags?

I am using X-Cart Classic 4.7.5

cflsystems 04-23-2016 04:34 AM

Re: How to add CSS to <Head></Head>
 
skin/YOUR_SKIN/customer/home.tpl

cocopops 04-24-2016 08:49 PM

Re: How to add CSS to <Head></Head>
 
Quote:

Originally Posted by cflsystems
skin/YOUR_SKIN/customer/home.tpl

Thanks.

If I need to add javascript, or a link to a .js file between the <body> </body> tags, do I also add it in home.tpl?

For example, if I need to add:
<script src="example.js"></script>

do I add it in home.tpl as well?

seyfin 04-25-2016 05:35 AM

Re: How to add CSS to <Head></Head>
 
Yes, you should add it to home.tpl as well.

See also:
* CSS and JavaScript optimization

pauldodman 04-26-2016 05:56 AM

Re: How to add CSS to <Head></Head>
 
If the css and/or js isn't needed on every page, and is only required on one page/place, you might want to add an if statement so it isn't called on every page.

cocopops 04-26-2016 06:24 AM

Re: How to add CSS to <Head></Head>
 
Quote:

Originally Posted by pauldodman
If the css and/or js isn't needed on every page, and is only required on one page/place, you might want to add an if statement so it isn't called on every page.


Hmm, that sounds like a good idea.

So for example, if I needed to call the css (sample.css) and js (sample.js) on only 1 of my static pages, say an FAQ page(www.domain.com/faq.html), how would the if statement look?

cflsystems 04-26-2016 07:40 AM

Re: How to add CSS to <Head></Head>
 
{if $page_data.pageid eq XX} load {/if}

Where XX is the static page id


All times are GMT -8. The time now is 04:43 PM.

Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.