Page 1 of 1

PHP variable inside CSS file

Posted: Tue Mar 09, 2010 1:58 am
by roice
Hello,
Is it possible to put PHP variable inside CSS file (style.css)?
If I'll change the style.css name to style.php, will the browser be able to read it as a style file?

Thank you in advance,
Roi

Re: PHP variable inside CSS file

Posted: Tue Mar 09, 2010 2:01 am
by Griven
Sorta.

Take a look at this tutorial: http://net.tutsplus.com/tutorials/php/s ... -the-hood/

Re: PHP variable inside CSS file

Posted: Tue Mar 09, 2010 5:17 am
by joppe
or you could have the style in the html (included from another file) and have all the php you want to form that

<head>
<style>
<?php include("style.php"); ?>
</style>
</head>
<body>
...

Re: PHP variable inside CSS file

Posted: Thu Mar 11, 2010 7:30 am
by roice
Thank you both!