Page 1 of 2 12 LastLast
Results 1 to 10 of 12
  1. #1
    Join Date
    May 2006
    Location
    Gardiner, Maine
    Posts
    2,231
    Plugin Contributions
    22

    Default 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?
    The full-time Zen Cart Guru. WizTech4ZC.com

  2. #2
    Join Date
    Jul 2005
    Location
    Upstate NY
    Posts
    22,010
    Plugin Contributions
    25

    Default Re: How to load css or js files for only one page

    http://www.zen-cart.com/wiki/index.p...s_-_Javascript

    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.

  3. #3
    Join Date
    May 2006
    Location
    Gardiner, Maine
    Posts
    2,231
    Plugin Contributions
    22

    Default Re: How to load css or js files for only one page

    Thanks for the quick reply!
    The full-time Zen Cart Guru. WizTech4ZC.com

  4. #4
    Join Date
    May 2006
    Location
    Gardiner, Maine
    Posts
    2,231
    Plugin Contributions
    22

    Default Re: How to load css or js files for only one page

    And dang, what a simple solution!
    The full-time Zen Cart Guru. WizTech4ZC.com

  5. #5
    Join Date
    Jan 2007
    Posts
    1,484
    Plugin Contributions
    10

    Default 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.

    Zen Cart and it's community are the best!!

  6. #6
    Join Date
    Jun 2005
    Location
    Cumbria, UK
    Posts
    10,250
    Plugin Contributions
    3

    Default 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)
    18 years a Zencart User

  7. #7
    Join Date
    Jul 2005
    Location
    Upstate NY
    Posts
    22,010
    Plugin Contributions
    25

    Default Re: How to load css or js files for only one page?

    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.

  8. #8
    Join Date
    Jun 2010
    Posts
    207
    Plugin Contributions
    1

    Default 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.

  9. #9
    Join Date
    Jul 2005
    Location
    Upstate NY
    Posts
    22,010
    Plugin Contributions
    25

    Default Re: How to load css or js files for only one page?

    You almost had it! Try index_home.css.

  10. #10
    Join Date
    Jun 2010
    Posts
    207
    Plugin Contributions
    1

    Default Re: How to load css or js files for only one page?

    Quote Originally Posted by gjh42 View Post
    You almost had it! Try index_home.css.
    Haha, so close yet so far away! This worked perfectly... thanks!

 

 
Page 1 of 2 12 LastLast

Similar Threads

  1. how to change css for one ez-page?
    By blrw in forum Templates, Stylesheets, Page Layout
    Replies: 2
    Last Post: 9 Mar 2012, 12:10 PM
  2. How do I create a css stylesheet for only my shopping cart page.
    By bigstore in forum Templates, Stylesheets, Page Layout
    Replies: 2
    Last Post: 21 Feb 2012, 04:26 PM
  3. Changing CSS rules for one page only.
    By CheekyCockney in forum Templates, Stylesheets, Page Layout
    Replies: 4
    Last Post: 14 Mar 2011, 12:53 AM
  4. CSS Stylesheet for One Product Only?
    By limelites in forum General Questions
    Replies: 4
    Last Post: 19 Jun 2010, 04:46 PM
  5. Css specific for just one page
    By s_p_ike in forum Templates, Stylesheets, Page Layout
    Replies: 2
    Last Post: 16 Nov 2006, 03:32 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
disjunctive-egg
Zen-Cart, Internet Selling Services, Klamath Falls, OR