Code to generate alternative CSS
Posted: Thu Mar 11, 2004 6:55 pm
Just looking for a little help with code clean up. Been hacking around with this and it works great but it looks too sloppy. I was wondering if there might be a better way of doing this. Here's the story, the people access the site have a high percentage of elderly. To make the site more accessible, I added a button that then loads an alternative CSS file with basically just larger fonts. Loads the preference in a session and follows them around while they are on the site. Like I said, I got it working but there must be a better way of doing it... Any suggestions? Here is how I got it working.
Code: Select all
<?php
session_start();
if ($_REQUEST['zoom'] == "off"){
session_unregister('zoom');
$css_image = "css_plus.gif";
$css_image_var = "on";
$css_image_alt = "View larger fonts for easier viewing";
$css_sheet = "gsfcu_style.css";
}elseif ($_SESSION['zoom'] == "on"){
$css_image = "css_minus.gif";
$css_image_var = "off";
$css_image_alt = "View normal sized fonts";
$css_sheet = "gsfcu_style2.css";
}elseif ($_REQUEST['zoom'] == "on"){
$zoom = "on";
session_register('zoom');
$css_image = "css_minus.gif";
$css_image_var = "off";
$css_image_alt = "View normal sized fonts";
$css_sheet = "gsfcu_style2.css";
}elseif (!($_SESSION['zoom'])){
$css_image = "css_plus.gif";
$css_image_var = "on";
$css_image_alt = "View larger fonts for easier viewing";
$css_sheet = "gsfcu_style.css";;
}
?>