Results 1 to 6 of 6
  1. #1
    Join Date
    Jul 2004
    Location
    The Netherlands, Wierden
    Posts
    430
    Plugin Contributions
    0

    Default 2 different stylesheets

    I want to make in a webshop 2 different stylesheets for different categories.

    Stylesheet 1 for all: layout, categories, sub-categories and products
    Stylesheet 2 for just one category, sub-categories and his products

    So it is possible to create for stylesheet 2 (lets say it is cpath=3) a different stylesheet for this. We have to create a stylesheet and name it c_3.css.

    Okay, that worked

    But when I'll go to a subcategorie or productinfo of this categorie, it will use the stylesheet 1.

    How can i work this out that all subcategories and products from the categorie cpath=3 will use stylesheet 2 --> c_3.css

  2. #2
    Join Date
    Jul 2004
    Location
    The Netherlands, Wierden
    Posts
    430
    Plugin Contributions
    0

    Default Re: 2 different stylesheets

    okay a little hack in the html_header.php
    Code:
        if ($cPath == '3_10' or $cPath ==  '3_15' or $cPath ==  '3_13') echo '<link rel="stylesheet" type="text/css" href="includes/templates/classic/css/c_3.css" />';
    So for "$cPath == '3_10' or $cPath == '3_15' or $cPath == '3_13'" i have to define every sub-category, that is pretty static.

    When i add a new sub-category to cPath3 I've to change this html_header.php manually....and i don't want to do that.

    Is it possible to give a sort of wildcart to it, like $cPath == '3_%

  3. #3
    Join Date
    Mar 2005
    Location
    UK
    Posts
    38
    Plugin Contributions
    0

    Default Re: 2 different stylesheets

    if you have a main category with cpath=1 and sub categories 1_2, 1_3, 1_4 then duplicate c_1.css with c_1_2.css, c_1_3.css and c_1_4.css and make any necessary change for it to display how you want.

    Would be nice with a wildcard but I suppose the above gives more control

  4. #4
    Join Date
    Jul 2004
    Location
    The Netherlands, Wierden
    Posts
    430
    Plugin Contributions
    0

    Default Re: 2 different stylesheets

    I know that is one solution, but i don't want to copy manually everytime when i create u sub-cat the stylesheet and rename it the cpath.css


    I've found another solution it works, but i got an error-message.

    The change is in the html_header.php
    Code:
    /**
     * load stylesheets on a per-page/per-language/per-product/per-manufacturer/per-category basis. Concept by Juxi Zoza.
     */
      $manufacturers_id = (isset($_GET['manufacturers_id'])) ? $_GET['manufacturers_id'] : '';
      $tmp_products_id = (isset($_GET['products_id'])) ? (int)$_GET['products_id'] : '';
      $sheets_array = array('/' . $_SESSION['language'] . '_stylesheet', 
                            '/' . $tmp_pagename, 
                            '/' . $_SESSION['language'] . '_' . $tmp_pagename, 
                            '/c_' . (int)$cPath .'/',
                            '/' . $_SESSION['language'] . '_c_' . (int)$cPath . '/',
                            '/m_' . $manufacturers_id,
                            '/' . $_SESSION['language'] . '_m_' . (int)$manufacturers_id, 
                            '/p_' . $tmp_products_id,
                            '/' . $_SESSION['language'] . '_p_' . $tmp_products_id
                            );
      while(list ($key, $value) = each($sheets_array)) {
    //echo "<--$value-->\n";
        $directory_array = $template->get_template_part($template->get_template_dir('.css',DIR_WS_TEMPLATE, $current_page_base,'css'), $value, '.css');
        sort($directory_array);
        while(list ($key2, $value2) = each($directory_array)) {
          echo '<link rel="stylesheet" type="text/css" href="' . $template->get_template_dir('.css',DIR_WS_TEMPLATE, $current_page_base,'css') . '/' . $value2 .'" />'."\n";
        }
      }
    The error i get is
    Code:
    Warning: preg_match() [function.preg-match]: No ending delimiter '/' found in \includes\classes\template_func.php on line 30

  5. #5
    Join Date
    Jul 2004
    Location
    The Netherlands, Wierden
    Posts
    430
    Plugin Contributions
    0

    Default Re: 2 different stylesheets

    with the html_header.php from 1.3.2 the proble is solved
    Attached Files Attached Files

  6. #6
    Join Date
    Jul 2004
    Location
    The Netherlands, Wierden
    Posts
    430
    Plugin Contributions
    0

    Default Re: 2 different stylesheets

    Is this also posible for the header? tpl_header.php?

    Using for cPath3 a different tpl_header.php?

 

 

Similar Threads

  1. stylesheets
    By jghogue in forum Templates, Stylesheets, Page Layout
    Replies: 1
    Last Post: 4 Nov 2011, 02:47 PM
  2. setting different stylesheets per language
    By davidnelband in forum Templates, Stylesheets, Page Layout
    Replies: 4
    Last Post: 16 Mar 2011, 11:30 PM
  3. How can I get 3 languages associated with 3 different templates & stylesheets?
    By local1970 in forum Templates, Stylesheets, Page Layout
    Replies: 2
    Last Post: 13 May 2009, 10:54 AM
  4. Multiple stylesheets for different browsers!
    By Shotgun Front in forum Templates, Stylesheets, Page Layout
    Replies: 2
    Last Post: 18 Apr 2008, 02:26 PM
  5. 2 Stylesheets
    By DanAllkins in forum Templates, Stylesheets, Page Layout
    Replies: 8
    Last Post: 20 Oct 2006, 02:37 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