Results 1 to 5 of 5
  1. #1
    Join Date
    Jul 2008
    Posts
    360
    Plugin Contributions
    0

    Default Moving css from top of a page to a new stylesheet what's the zen way to link?

    I had a page with a css declaration on top and I moved it to another stylesheet, so my question is if I have to add a

    HTML Code:
    <LINK REL=StyleSheet HREF="mystyle.css" TYPE="text/css" MEDIA=screen>
    to the place where the css styles where, what's the Zen way to do it?

    I mean what functions I have to call, to replace that html?

    That(the stylesheet mystyles.css), will be inside my template's css directory.

  2. #2
    Join Date
    Sep 2009
    Location
    Stuart, FL
    Posts
    13,872
    Plugin Contributions
    96

    Default Re: Moving css from top of a page to a new stylesheet what's the zen way to link?

    I'm not sure what you mean by "on top", but zen-cart will automatically load all stylesheets named style*.css from your current template's /css folder. You could try renaming mystyles.css to something like stylesheet_mine.css (I *think* that that will cause it to load after your stylesheet.css file).

  3. #3
    Join Date
    Nov 2006
    Location
    Dartmouth, NS Canada
    Posts
    2,378
    Plugin Contributions
    0

    Default Re: Moving css from top of a page to a new stylesheet what's the zen way to link?

    Quote Originally Posted by icecold View Post
    I mean what functions I have to call, to replace that html?

    That(the stylesheet mystyles.css), will be inside my template's css directory.
    You don't need to do any function calls. As stated above ZC will automatically load all stylesheets it finds in the current template's css folder. If you just need to add a few bits of CSS, you could more easily add them to the bottom of the main stylesheet.css file. Or you could, as you say, make a styles_mystyles.css stylesheet. But don't put any more in there than necessary to make your CSS mods.

    Rob

  4. #4
    Join Date
    Jul 2008
    Posts
    360
    Plugin Contributions
    0

    Default Re: Moving css from top of a page to a new stylesheet what's the zen way to link?

    Quote Originally Posted by rstevenson View Post
    You don't need to do any function calls. As stated above ZC will automatically load all stylesheets it finds in the current template's css folder. If you just need to add a few bits of CSS, you could more easily add them to the bottom of the main stylesheet.css file. Or you could, as you say, make a styles_mystyles.css stylesheet. But don't put any more in there than necessary to make your CSS mods.

    Rob
    ok, but I thought it would be a more elegant and probably efficient way to do that, instead of just entering the link, using Zen_href or other ZC php functions.

    I know where the stylesheets go and please note mystylesheet.css is not the name of the real thing is just an example, I wanted to understand if there was a ZC way to write links inside the code. I supposed you can call a function using the override system and just wanted to know the syntax. All my css stylesheets are minimized, shrunk after they load.

  5. #5
    Join Date
    Jul 2008
    Posts
    360
    Plugin Contributions
    0

    Default Re: Moving css from top of a page to a new stylesheet what's the zen way to link?

    ok, I see there is code that simply loads all css files inside the css directory of the current template, is this piece of code
    PHP Code:
        foreach($files['css'] as $file)
            if(
    $file['include']) include($file['src']);
            else if(!
    $RI_CJLoader->get('minify') || $file['external']) echo "<link rel=\"stylesheet\" type=\"text/css\" href='{$file['src']}' />\n";
            else echo 
    "<link rel=\"stylesheet\" type=\"text/css\" href=\"min/?f={$file['src']}&amp;".$RI_CJLoader->get('minify_time')."\" />\n"
    This is part of the minify script, but it does load all css files inside the directory. So now I understand why there is nothing to be added just the file and it will be loaded automatically by the code.

 

 

Similar Threads

  1. The Quickest and Easiest way to work out what does what on the CSS style sheet
    By janissaire in forum Templates, Stylesheets, Page Layout
    Replies: 47
    Last Post: 5 Jul 2012, 03:05 AM
  2. Stylesheet class...quick list for what's what on the page
    By AllofUs in forum Templates, Stylesheets, Page Layout
    Replies: 4
    Last Post: 21 Aug 2008, 04:49 PM
  3. What's the easiest way to add custom fields to the New Product page?
    By christopherw in forum Setting Up Categories, Products, Attributes
    Replies: 4
    Last Post: 18 Sep 2007, 06:16 PM
  4. 1.3.x new stylesheet CSS and page size
    By Jiancai in forum General Questions
    Replies: 3
    Last Post: 24 Jun 2006, 06:19 AM

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