How to load css or js files for only one page?
I am aware that you can put a separate footer onto a specific page by adding in that footer in a template folder that is named for the page.
But can you do that for loading css or jscript files as well by adding in a html_header.php file? I thought that made sense but doesn't work. Is my only alternative to put in php into the html header file?
Can you give me a general set of guidelines as to what can be used in this fashion besides the footer?
Re: How to load css or js files for only one page
http://www.zen-cart.com/wiki/index.p...s_-_Javascript
Quote:
Page-Specific jscript's
For page-specific operation, put the file under the /includes/modules/pages/{pagename}/ folder.
jscript*.js files -- to be "linked" by your site
NOTE: jscript_*.js files must not contain any <script...> .... </script> tags. They should contain ONLY the contents that are to go "between" those tags.
For CSS, see the CSS-readme.txt in the /template_default/css/ folder.
Re: How to load css or js files for only one page
Thanks for the quick reply!
Re: How to load css or js files for only one page
And dang, what a simple solution!
Re: How to load css or js files for only one page
For anyone else wondering and coming across this thread, you simply create a CSS file with the page name and put it in your template's CSS directory. So for instance, if you want a specific file for the shopping cart page you create a CSS file called shopping_cart.css and put it in the CSS directory. It needs to be called whatever the page is called, if you are not sure there are 2 ways to check. One by going to that page on your site, the file should be called whatever main_page= is in the URL. Or, you can go to includes/modules/pages and whatever each file directory is named is what you should use.
Re: How to load css or js files for only one page?
ZC 1.3.9h will also enable EZPage-specific stylesheets.
See this in action, where I alternate site header logos, depending on the EZPage being viewed:-
http://britefactory.co.uk/streetball (STILL IN DEVELOPMENT)
Re: How to load css or js files for only one page?
Quote:
ZC 1.3.9h will also enable EZPage-specific stylesheets.
Unfortunately, the code that does this disables generic ez-page stylesheets (you can have one for page_13.css, but not page.css). The Improved Stylesheet Calls mod allows a generic ez-page stylesheet as well as chapter and individual ez-page stylesheets.
Re: How to load css or js files for only one page?
I know this thread is old, but I thought it would be best to ask here instead of starting a new thread.
My home page needs formatting specific only to it; all other pages of my site will not have that home-page specific formatting. How can I set up a CSS file that is used only by the home page? I tried home.css and index.css, but neither worked.
Re: How to load css or js files for only one page?
You almost had it! Try index_home.css.
Re: How to load css or js files for only one page?
Quote:
Originally Posted by
gjh42
You almost had it! Try index_home.css.
Haha, so close yet so far away! This worked perfectly... thanks!