02.19.04
Choose For Yourself
After working out a particularly strange solution for a client’s web publishing system mess, I decided that before the client’s developers poured too much time into it, I really ought to figure out if the solution would actually work.
Essentially, what needs to happen is for JavaScript to control Server-Side Includes.
“But Ross!”, you say. “SSI’s are executed on the server, well before any JavaScript gets executed. Anything you do will require passing back a Post via a form, or at the least, a query string… right?”
Not quite. It turns out that SSIs can be used to parse the HTTP_COOKIE environment variable. Set this up with the right statements and the site should be able to make JavaScripts control the SSIs.
My demo? My own site of course: rossolson.com also known as ordersomewherechaos.com.
As of late last night, instead of the layout always changing every hour, you can now control the layout with a little pulldown menu in the navigation bar. The pulldown has a JavaScript call that sets a cookie and then reloads the page that it’s on.
The code that I used to have simply rotating the layouts now looks to see if the cookie is set first. If it is, the layout is chosen appropriately. If it’s not then it’s a free for all and your get the layout you’re given.