News Feed
Sections




News Archive
Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

phpPro.org:
Embedding PHP In CSS
April 13, 2009 @ 12:05:52

New on the phpPro site is this article looking at a technique for embedding PHP inside of your CSS files and have it correctly interpreted.

Perhaps one of the most frustrating aspects of using PHP with websites, is getting variables into CSS. Having variables stored in an ini file, config file or even a database can make the updating of the look and feel of a site simple, however, CSS files, by default, do not parse PHP. [...] A html file may also include a PHP file, in the same manner as it includes a CSS file. This means the stylesheet can be renamed from style.css to style.php.

Using this method, the PHP inside the file is parsed and, because its included with a link tag, the CSS is also made available to the rest of the page.

5 comments voice your opinion now!
embed css link parse webserver


blog comments powered by Disqus

Similar Posts

NETTUTS.com: Tools of the Trade: Web Development Frameworks that the Pros Use

DevShed: Tracking Parsing Errors with the Tidy Library in PHP 5

LineshJose.com: How To: Create A Simple CSS Compressor Using PHP

Ryan Grove's Blog: Minify combines, minifies &caches JavaScript & CSS files to speed up page loads

Sameer's Blog: Simple Pagination in PHP tutorial


Community Events





Don't see your event here?
Let us know!


tips series voicesoftheelephpant deployment podcast laravel bugfix list symfony api opinion interview framework community developer language library introduction zendserver release

All content copyright, 2014 PHPDeveloper.org :: info@phpdeveloper.org - Powered by the Solar PHP Framework