I'm processing a CSS stylesheet as PHP by including the following at the top of my CSS file:
<?php
header("Content-type: text/css; charset: UTF-8");
?>
My CSS stylesheet (style.css) is called like this:
<style type="text/css">@import url("style.css") only screen and (min-device-width: 321px), only print;</style>
I have altered my Apache config file in the following way to enable the CSS file to be processed by the PHP engine:
<FilesMatch "^.*?common.*?$">
SetHandler php5-script
</FilesMatch>
In my CSS file, beneath the header, is regular CSS content with the occasional php snippet, e.g.
...
<?php echo "* {margin: 10px; padding: 10px;}"; ?>
html
{
background-color: #FFF;
overflow-y: scroll;
}
The above works fine, however if I try to include a php conditional statement I run into problems. For example, the following:
<?php
echo "* {";
if ($fixed_navigation_Home == "none") {echo "display: none;";}
else {echo "display: block;";}
echo "}";
?>
... produces only:
* {
}
... instead of one of the two style rules requested in the PHP.
Is anyone able to advise me what might be going wrong? Thanks for reading.
$fixed_navigation_Homevariable?