THIS HAS BEEN RESOLVED, ME THE NEWBIE CAN'T DO PHP! :rolleyes:
Hi, I've got a little problem, I am trying to create a php file for generating dynamic CSS files. But i almost came to a stop immediately :mad:
I simply got in my html document's head tag:
<link rel="stylesheet" type="text/css" media="screen" href="css.php?id=default" />
And css.php is:
<?php
/*
* Generates a dynamic css file.
*/
header('Content-type: text/css'); //What datatype to return.
$default = array('bodyBgColor' => 'ffffff';
$dblack = array('bodyBgColor' => '000000';
$blue = array('bodyBgColor' => '0000ff';
switch ($_GET['id']){
case 'black':
$scheme = $black;
break;
case 'blue':
$id = $blue;
break;
default:
$id = $default;
break;
}
//Using heredoc syntax to print:
print <<<_CSS
body { background-color: #$scheme['bodyBgColor']; }
_CSS; //Must be in first column.
?>
Although I have set the content-type to text/css in my php, it seems like it still returns text/html. My question is simply: How do i set the return data type to text/css?