navigation
a webmaster learning community
     Home    Register     Search      Help      Login    
FrontPage Alternative
Sponsors

Shopping Cart Software
Ecommerce software integrated into Frontpage, Dreamweaver and Golive templates. No monthly fees and available in ASP and PHP versions.

Website Templates
We also have a wide selection of Dreamweaver, Expression Web and Frontpage templates as well as webmaster tools and CSS layouts.

Frontpage website templates
Creative Website Templates for FrontPage, Dreamweaver, Flash, SwishMax

Search Forums
 

Advanced search
Recent Posts

 Todays Posts
 Most Active posts
 Posts since last visit
 My Recent Posts
 Mark posts read

 

silly noob CSS question

 
View related threads: (in this forum | in all forums)

Logged in as: Guest
Users viewing this topic: none
Printable Version 

All Forums >> Web Development >> Cascading Style Sheets >> silly noob CSS question
Page: [1]
 
reformed hater

 

Posts: 167
Joined: 2/1/2006
From: The land of sun and hurricanes; US
Status: offline

 
silly noob CSS question - 4/20/2006 17:27:26   
How do I launch a second style page.... I want the user (in this case my boss) to just hit a button and get the alt style

please don't say it's as easy as doing a second link...:)

_____________________________

When asked what the White House was like by a British student George W. Bush responded “It is White"
jaybee

 

Posts: 14191
Joined: 10/7/2003
From: Berkshire, UK
Status: offline

 
RE: silly noob CSS question - 4/20/2006 18:15:51   
Google for Stylesheet Switcher.

_____________________________

If it ain't broke..... fix it until it is.
:)

:)
GAWDS
Now where did I put that Doctype?

(in reply to reformed hater)
Tailslide

 

Posts: 6290
Joined: 5/10/2005
From: Out here on the raggedy edge
Status: offline

 
RE: silly noob CSS question - 4/21/2006 3:54:11   
There are Javascript versions and PHP versions going back a couple of years or so.

I've implemented both and found the "original" Paul Sowden stylesheet switcher a bit of a pain to implement if you're fairly new to the subject. It certainly works fine - it does take a bit of yelling and shouting at the computer to get it to work (ask Womble).

If you have PHP on your webserver then I've got an incredibly easy PHP switcher (given to me by a certain new member of this forum) which I use on my site. I can't tell you how easy it was to get working. Took five minutes.

_____________________________

"My strategy is so simple an idiot could have devised it"
Little Blue Plane Web Design | Blood, Sweat & Rust - A Land Rover restoration project

(in reply to jaybee)
jaybee

 

Posts: 14191
Joined: 10/7/2003
From: Berkshire, UK
Status: offline

 
RE: silly noob CSS question - 4/21/2006 5:44:42   
Right, yes, well where is it then. I have to do one this afternoon. You have my email. :)

_____________________________

If it ain't broke..... fix it until it is.
:)

:)
GAWDS
Now where did I put that Doctype?

(in reply to Tailslide)
womble

 

Posts: 5702
Joined: 3/14/2005
From: Living on the edge
Status: offline

 
RE: silly noob CSS question - 4/21/2006 6:04:02   
quote:

I've implemented both and found the "original" Paul Sowden stylesheet switcher a bit of a pain to implement if you're fairly new to the subject. It certainly works fine - it does take a bit of yelling and shouting at the computer to get it to work (ask Womble).

Please don't remind me Tail. If I recall it took some extra javascript, assistance from a spaceship avatar sporting person, and lots of shouting to get it to work. The effect of getting that one to work has put me off stylesheet switchers and I reverted to providing instuctions for using the alternate sheets in 'nice' browsers. :)

_____________________________

~~ "A cruel god ain't no god at all" ~~
~~ Erase hate. Practice love. ~~
:)

(in reply to jaybee)
Tailslide

 

Posts: 6290
Joined: 5/10/2005
From: Out here on the raggedy edge
Status: offline

 
RE: silly noob CSS question - 4/21/2006 6:29:20   
Exactly - it works all right but it can be "bleeding from the ears" painful to get really right (precedence of stylesheets etc).

Ok - so this is Mike's simple PHP stylesheet switcher (all bow to the green beastie man). It's a simple "swapsie" thing - one stylesheet for another so each stylesheet needs to be complete in itself. If you want to just increase text size for example you'd have to have a complete stylesheet with larger font-size rather than just the larger font-size rule - does that make sense?

This also sets a cookie.

So add this before your DOCTYPE:

<?php
$cssFile = "css/defaultstyle.css";
if(isset($_COOKIE["MYCSS"]) && !isset($_GET["MYCSS"])){
$cssFile = $_COOKIE["MYCSS"];
}
if(isset($_GET["MYCSS"]) &&
file_exists('css/'.$_GET["MYCSS"].'.css')){
setcookie("MYCSS", "css/".$_GET["MYCSS"].".css", 
time()+60*60*24*30,
'/');
$cssFile = "css/".$_GET["MYCSS"].".css";
}
?>


Add this as your stylesheet link:
<style type="text/css" media="screen" title="Selected Style"> @import "<?php echo $cssFile; ?>";</style>


And this is your list of "switches":
<ul id="options">
<li><a href="<?php echo $_SERVER["PHP_SELF"]; ?>?MYCSS=defaultstyle">Default</a></li>
<li><a href="<?php echo $_SERVER["PHP_SELF"]; ?>?MYCSS=red">Red version</a></li>
<li><a href="<?php echo $_SERVER["PHP_SELF"]; ?>?MYCSS=blue">Blue version</a></li>
</ul>


Ha! That's it! Just ever so slightly easier than the last JS one I tried to implement! :)

Note that you'll have to change the names of the stylesheets involved and ensure that the path in the top bit is correct. Currently it's css/whatever.

< Message edited by Tailslide -- 4/21/2006 6:41:29 >


_____________________________

"My strategy is so simple an idiot could have devised it"
Little Blue Plane Web Design | Blood, Sweat & Rust - A Land Rover restoration project

(in reply to womble)
womble

 

Posts: 5702
Joined: 3/14/2005
From: Living on the edge
Status: offline

 
RE: silly noob CSS question - 4/21/2006 6:40:32   
/bows down to the green beastie man

Oooooh! That looks nice! :) I may even be tempted to give stylesheet switchers another go...

_____________________________

~~ "A cruel god ain't no god at all" ~~
~~ Erase hate. Practice love. ~~
:)

(in reply to Tailslide)
Tailslide

 

Posts: 6290
Joined: 5/10/2005
From: Out here on the raggedy edge
Status: offline

 
RE: silly noob CSS question - 4/21/2006 6:44:30   
Only thing is that because the stylesheet is called via a @import rather than a link, you'll want to ensure you've got a link in the head somewhere (favicon or maybe a print stylesheet?) just to ensure you don't get any naughty FOUC action.

_____________________________

"My strategy is so simple an idiot could have devised it"
Little Blue Plane Web Design | Blood, Sweat & Rust - A Land Rover restoration project

(in reply to womble)
jaybee

 

Posts: 14191
Joined: 10/7/2003
From: Berkshire, UK
Status: offline

 
RE: silly noob CSS question - 4/21/2006 7:24:11   
Super. Green Beasts do have their uses. :)

_____________________________

If it ain't broke..... fix it until it is.
:)

:)
GAWDS
Now where did I put that Doctype?

(in reply to Tailslide)
Page:   [1]

All Forums >> Web Development >> Cascading Style Sheets >> silly noob CSS question
Page: [1]
Jump to: 1





New Messages No New Messages
Hot Topic w/ New Messages Hot Topic w/o New Messages
Locked w/ New Messages Locked w/o New Messages
 Post New Thread
 Reply to Message
 Post New Poll
 Submit Vote
 Delete My Own Post
 Delete My Own Thread
 Rate Posts