problems trying to use PHP to choose CSS
| From: | Timothy J. Luoma | Date: | Thu, 01 Jan 1970 00:00:00 +0000 |
| Subject: | problems trying to use PHP to choose CSS | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-90753@lists.php.net to get a copy of this message | ||
Hello PHP friends
I went searching (Core PHP Programm, php.net and google) for an
answer, but didn't find anything that did what I want, namely: Use PHP to
set the style sheet for a site.
I am trying this method: Register a global variable ($CSS) using a FORM.
Currently this does not work at all in Internet Explorer ver6. It does
work in Mozilla 0.99 and Opera v6, but ONLY for page when it reloads... as
soon as I go to another page, the $CSS variable seems to get reset to
'global'
I wonder if I am not doing something stupid/overlooking something obvious,
but I am very new @ PHP so that is possible.
I have attached my various code snippets here.
// in my global PHP file
// Now what I am trying to do here is set a default that should ONLY be
// used if the $CSS variable is NOT already set
if (!isset($CSS))
{
// if it is not set, then and only then set it and define it
session_start();
session_register("CSS");
$CSS="global";
}
// in my global header file:
// this should take the variable $CSS and use it for the style sheet
// yes the .css should be appended to the $CSS
echo <<< EOD
<link type="text/css" rel="stylesheet"
href="/global/css/$CSS.css"
/>
EOD;
//in my global footer file
// here is where we set the variable by the FORM and reload the page
echo <<< EOD
<div style="text-align: right">
<form action="$PHP_SELF" method="post">
<p>Choose style:
<select name="CSS">
<option value="default" selected="selected">Default</option>
<option value="smaller">Smaller</option>
<option value="tamecolors">Tamer Colors</option>
<option value="print">Print</option>
</select>
<input alt="Set Style" type="submit" name="Set Style"
value="Set Style" />
</p>
<p>Current style is: <strong>$CSS</strong></p>
</form>
</div>
EOD;
Any help appreciated....
Thanks
TjL
--
Site: www.tntluoma.com mailto:luomat@peak.org
Info: Apache/1.3.19 (Unix) with PHP/4.0.6