Hi everyone,
I'm facing a problem and I don't know how to solve it (nor if it can be solved). I want my website to have different colours depending on the directory of the file. For example:
http://www.bruheim.net/nieuws/ becomes yellow fonts.
http://www.bruheim.net/reizen/ becomes red fonts.
My stylesheet is called 'normal.css.php'. Some of the code:
<?php
header("Content-type: text/css");
// der richtige MIME-Typ:
// include ("kleurenkiezer.php");
switch($mycolor) {
case "Nieuws" : { $hardcolor = "#FFFF00"; $softcolor = "#FEFF91";} break;
case "Reizen" : { $hardcolor = "#0000FF"; $softcolor = "#9194FF";} break;
case "css" : { $hardcolor = "#00FF00"; $softcolor = "#91FF91";} break;
case "bruheim" : { $hardcolor = "#FF0000"; $softcolor = "#FF9191";} break;
default:{
$hardcolor = "#9933FF";
$softcolor = "#9194FF";
;}
}
?>
The code from 'kleurenkiezer.php ' is this:
<?php
// Een arry bc_label vullen:
$bc_label = array(
"nieuws" => "Nieuws",
"reizen" => "Reizen",
"css" => "css",
"bruheim" => "bruheim"
);
$myhost = $SERVER['HTTP_HOST']; // What is the current host?
$mysite = $SERVER['PHP_SELF']; // What comes behind that in the url?
//echo ("Mijn site: $mysite <BR>");
$str = substr(dirname($mysite), 1); // Which sub-directories am I working in?
//echo ("String: $str <BR>");
$arr = split('/', $str); // Splitting string by /
$num = count($arr); // How many sub-directories?
//echo ("delen: $num <BR>");
$val = $arr[2]; // Take the first array and call it $val (was 0)
//echo ("$val"); // What is $val?
$mycolor = $bc_label[$val]; // Take the code from above.
?>
The problem:
'kleurenkiezer.php' works fine, but doesn't work correct when it is included in the Stylesheet. In that case the res
E16
ult is always 'css'. I don't want a second stylesheet, as that gives you much work if you want something to alter later. But is there an other solution for this problem?