Skip to:
Content
Pages
Categories
Search
Top
Bottom

Re: in css

@rubelo

Member

Actually thats not true. I’ve done this several times and in the PHPulse MVC Framework use this trick.

If you declare your CSS as ‘file.css.php’ rather than ‘file.css’, the file will be parsed as PHP and output to be read as CSS. Since the webserver handles the request for the CSS request, it sees the file extension and parses it a PHP. But the browser expects back a CSS page (as you declared it within the header as type ‘text/css’).

This is convenient as it enables you to import PHP settings into your CSS sheets such as defines to set colors, fonts, sizes, etc across all style sheets. This enables to to easily create and change themes without changing a million lines in your CSS.

Skip to toolbar