Page 1 of 1

CSS Basic Question

Posted: Wed Jan 28, 2009 4:50 pm
by bloodl
Is it possible to have php echoing in style sheets?

I was going to have a standard CSS doc with a PHP include which grabbed my external colors, then echo the HEX values into the CSS color values. Can this work ? Maybe I am going about it all wrong?

Re: CSS Basic Question

Posted: Wed Jan 28, 2009 4:53 pm
by nor0101
easily done:

Code: Select all

 
<style type="text/css" media="all">
    @import url("./style.php");
</style>
 
now you can use PHP in your stylesheet!

Re: CSS Basic Question

Posted: Wed Jan 28, 2009 5:12 pm
by bloodl
Thanks for your reply!!

So I understand correctly, style.php can have a mixture of php code and styles ?

Re: CSS Basic Question

Posted: Wed Jan 28, 2009 5:28 pm
by nor0101
Yes, it must be a PHP script that when run outputs valid CSS though.

Re: CSS Basic Question

Posted: Wed Jan 28, 2009 5:37 pm
by bloodl
thanks heaps!