28, May 2012

what name has the style switcher ? - webmaster forum

 
Webdigity webmaster forums
[ Home | Help | Search | Forum's Shop | Archive | Login | Register | Webmaster Directory ]
Webdigity Webmaster Forums  >  Web Development  >  PhP  >  PHP classes @finalwebsites.com  >  Miscellaneous scripts or snippets (Moderator: Olaf)
Topic: what name has the style switcher ?
« previous next »
Pages: [1] Print

Author Topic: what name has the style switcher ?  (Read 1873 times)
Google dot what?
*
Posts: 2
16 credits
Members referred : 0


« on: Jul 10, 2006, 01:35:18 pm »

Hello,

Here :http://www.finalwebsites.com/snippets.php?id=31
you see the style switcher but as its clear that the first part (php) should be saved as "some" file nowhere is mentioned what name..

Sop whats the name?
Moderator
Community Supporter ?
Jedai Sword Master
*****
Gender: Male
Posts: 6691
34714 credits
Members referred : 374


It's time to use PHP5!


« Reply #1 on: Jul 10, 2006, 06:16:31 pm »

I include this code always in my general include (the same file where are all my other functions)
if this is done its easy tro access this code with:
Code:
<!-- EXAMPLE: place this inside your html header -->
<link href="/includes/<?php echo $css_file?>" rel="stylesheet" type="text/css">
<!-- place this code inside the body where you want to show the links -->
<?php echo style_switcher(); ?>

don't forget that the current style sheet name is stored inside a session

Google dot what?
*
Posts: 2
16 credits
Members referred : 0


« Reply #2 on: Jul 10, 2006, 08:00:37 pm »

hello,
sorry but i dont understand and it doesnt answer my question.. Cry
what name should i give this file ?

Code:
<?php
session_start
();
$all_css = array();

$all_css['yellow']['file'] = "home_geel.css";
$all_css['blue']['file'] = "home_blauw.css";
$all_css['modern']['file'] = "home_modern.css"// default

$all_css['yellow']['label'] = "Yellow!";
$all_css['blue']['label'] = "Deep blue";
$all_css['modern']['label'] = "Final..."// default

$default_value "modern"// set the default value here

if (isset($_GET['change_css']) && $_GET['change_css'] != "") {
    
$_SESSION['css'] = $_GET['change_css'];
} else {
    
$_SESSION['css'] = (!isset($_SESSION['css'])) ? $default_value $_SESSION['css'];
}
switch (
$_SESSION['css']) {
    case 
"yellow":
    
$css_file "home_geel.css";
    break;
    case 
"blue":
    
$css_file "home_blauw.css";
    break;
    default:
    
$css_file "home_modern.css";
}
function 
style_switcher() {
    global 
$all_css;
    
$style_links "Style switch:&nbsp;\n";
    foreach (
$all_css as $key => $val) {
        if (
$_SESSION['css'] != $key) {
            
$style_links .= "<a href=\"".$_SERVER['PHP_SELF']."?change_css=".$key."\">";
            
$style_links .= "<b>".$val['label']."</b></a>&nbsp;&nbsp;\n";
        } else {
            
$style_links .= "<b>".$val['label']."</b>&nbsp;&nbsp;\n";
        }
    }
    return 
$style_links;
}
?>
Moderator
Community Supporter ?
Jedai Sword Master
*****
Gender: Male
Posts: 6691
34714 credits
Members referred : 374


It's time to use PHP5!


« Reply #3 on: Jul 10, 2006, 11:09:49 pm »

maybe css_style.php?

check the include function, too...

Trackback URI for this entry : http://www.webdigity.com/trackback.php?topic=3212
Tags : html Bookmark this thread : Digg Del.icio.us Dzone more....

Pages: [1] Print 
Webdigity Webmaster Forums  >  Web Development  >  PhP  >  PHP classes @finalwebsites.com  >  Miscellaneous scripts or snippets (Moderator: Olaf)
Topic: what name has the style switcher ?
« previous next »
Jump to:
User Area
Welcome, Guest. Please login or register.
Did you miss your activation email?
May 28, 2012, 12:03:09 pm





Login with username, password and session length

Donate to our community, and get a permanent link back to your site!

Donate to our community, and get a permanent link back to your site!






Web Design Gallery · Whois Lookup · Pagerank · Tag Browsing · Lo-fi version · Syndication · Webmaster forum history · Advertise
Developed by HumanWorks © 2005 - 2012 Webdigity webmaster community · sublime directory
Webdigity Webmaster Forums | Powered by SMF 1.0.12. © 2001-2005, Lewis Media. All Rights Reserved.