ExpressionEngine CMS
Open, Free, Amazing
Brought to you by

Thread

Problem with CSS Switcher

July 06, 2007 5:58am

Subscribe [1]
  • #1 / Jul 06, 2007 5:58am

    julianps's avatar

    julianps

    175 posts

    Update - when I close and restart the browser Safari/Mac and IE7/Win both see “Green”; If I select another option (ie “Blue”)+Enter Safari3/Mac changes (to Blue) but neither FF/IE do. Does this suggest an issue with the Form? ————————————————————-<Original Posting>———-

    I thought it would just work.

    I added pi.css_switcher.php to the correct folder, I changed “var $css = array(” to;

    '1' => "http://jules-macbook.local.:9000/index.php?css=rw_simple/blue_css",
    '2' => "http://jules-macbook.local.:9000/index.php?css=rw_simple/green_css",
    '3' => "http://jules-macbook.local.:9000/index.php?css=rw_simple/grey_css",
    '4' => "http://jules-macbook.local.:9000/index.php?css=rw_simple/soft_pink_css",
    '5' => "http://jules-macbook.local.:9000/index.php?css=rw_simple/vibrant_pink_css"

    I updated the Form to;

    <?
    $css_refer= $_SERVER ['REQUEST_URI'];
    $css_refer = explode("?", $css_refer);
    ?>
    <!-- <form action="index.php" method="post"> -->
    <form action="<?=$css_refer[0]?>" method="post">
    <select name="css_skin" id="css_skin">
    <option value="1">Blue</option>
    <option value="2">Green</option>
    <option value="3">Grey</option>
    <option value="4">Soft Pink</option>
    <option value="5">Vibrant Pink</option>
    </select>
    </form>
    
    

    and set PHP for the template to ON/INPUT.

    I added the following to my <head> tags;

    {exp:css_switcher}
    <link rel='stylesheet' type='text/css' media='all' href='{file}' />
    <style type='text/css' media='screen'>@import "{file}";</style>
    {/exp:css_switcher}
    <!-- <link rel="stylesheet" type="text/css" media="screen" href="{stylesheet={my_template_group}/soft_pink_css}" /> -->

    I set the following;

    var $default        = '2';

    Where am I now?

    1. I have the drop-down list.
    2. My default style, in fact my only style, is blue_css
    3. The default (ie green_css) is ignored
    4. I get no switching
    5. To say I have no idea what “..
    2. files=”” Creates the $css array on load using the stylesheet URLs listed in the parameter. Separate each URL with a pipe (“|”). The first stylesheet will be given an array key of 1, and the rest after will be incremented by a value of one (2, 3, 4, etc.) by their order.”

    means understates my lack of understanding over the PHP in general and this plugin in particular.

    Obvious point;

    This installation is not running on a production server; it’s running on the standard MacOSX Apache/PHP-enable + entropyMySQL with the domain-names provided by HEADDRESS.

    Can anyone spot the obvious “Duh!” or do I simply need to try it on a production domain to see it in all it’s glory……;)

    Thanks/J

.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases