22, August 2008

what name has the style switcher ? - webmaster forum

 
Webdigity webmaster forums
This forum shares its ad revenue with its members!
[ 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 1209 times)
Google dot what?
*
Posts: 2
16 credits
Members referred : 0


« on: Jul 10, 2006, 02: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: 6300
38626 credits
Members referred : 374


It's time to use PHP5!


« Reply #1 on: Jul 10, 2006, 07: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


Last blog : Create custom backups from your website using cURL
Google dot what?
*
Posts: 2
16 credits
Members referred : 0


« Reply #2 on: Jul 10, 2006, 09: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: 6300
38626 credits
Members referred : 374


It's time to use PHP5!


« Reply #3 on: Jul 11, 2006, 12:09:49 AM »

maybe css_style.php?

check the include Visit through proxyfunction, too...


Last blog : Create custom backups from your website using cURL
Trackback URI for this entry : http://www.webdigity.com/trackback.php?topic=3212
Tags : html Bookmark this thread : Digg Del.icio.us Dzone more....

Topic sponsors:
Get a permanent link here for $1.99!


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?
Aug 22, 2008, 06:26:30 AM





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!


Forum Statistics
Total Posts: 36.084
Total Topics: 7.439
Total Members: 3.807
Tutorials : 56
Resources : 143
Designs : 220
Latest Member: marthawelch

21 Guests, 2 Users online :

14 users online today:



Readers

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