From: James Britt Date: 2005-10-05T14:46:02+09:00 Subject: Re: CSS switcher in Ruby? Tom Cloyd wrote: > What I had in mind was to do what the fairly common PHP server-side CSS > switcher does, only with Ruby. There are advantages to a server-side > solution, and if someone coded it in Ruby I'd probably understand it > someday. I hope never to have to understand (i.e., study) PHP. I have a > life outside of computers, and that leaves very little free time. > So...hoping for an all-Ruby little world I can live in. > > I agree that it seems trivial...but not for me. Someone else, maybe? > > Here's the PHP switcher article on A List Apart, for example... > > http://www.alistapart.com/articles/phpswitch/ > Ah. Yes, that would make a decent project for getting into Ruby. Off the top of my head: Create dynamic_css.rb (or whatever you call it) Make it: Read a cookie to see if there are any current values to apply Check for the presence of any querystring to see if there are new values to handle. Use those values in building some CSS. Return the CSS text, with the correct content-type header. And set a new cookie, too, for the next request Take a look at the Ruby CGI class http://www.ruby-doc.org/stdlib/libdoc/cgi/rdoc/classes/CGI.html Ask questions here if you get stuck. James -- http://www.ruby-doc.org - The Ruby Documentation Site http://www.rubyxml.com - News, Articles, and Listings for Ruby & XML http://www.rubystuff.com - The Ruby Store for Ruby Stuff http://www.jamesbritt.com - Playing with Better Toys