View Single Post
  #4 (permalink)  
Old Oct 11th, 2007, 10:58
Rakuli's Avatar
Rakuli Rakuli is offline
SuperMember

SuperMember
Join Date: Sep 2007
Location: Australia
Age: 24
Posts: 956
Blog Entries: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Re: Changing CSS with PHP

This would be easy to achieve with PHP. If you send the name of the css of the query string

Say you send the css name like thisismyurl.php?style=css1

then in your php

PHP: Select all

$style 'css1';


// Store the style choice into the session to carry it around pages
if (!empty($_GET['style']))
    
$_SESSION['style'] = $_GET['style'];


// Now choose the selected style
switch ($_SESSION['style'])
{
    case 
'css1' :
         
$style'css1';
         break;
    case 
'css2' :
        
$style 'css2';
        break;
    case 
'css3' :
        
$style 'css3';
        break;
    case 
'css4' :
        
$style 'css4';
        break;
}

// ECho the required style
echo '<link type="text/css" rel="stylesheet' href="', $style, '" />; 
Hope that helps,

Cheers.
Reply With Quote