Re: Using PHP with Style Sheets

From: Date: Mon, 19 Jan 2004 09:43:44 +0000
Subject: Re: Using PHP with Style Sheets
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-175006@lists.php.net to get a copy of this message
On Monday, January 19, 2004, at 06:18 PM, Freedomware wrote:
I just learned that you can even use PHP on style sheets. Can anyone here tell me how to set it up?
Add this to your .htaccess file: <Files ~ "\.css$"> ForceType application/x-httpd-php </Files> Add this to the top of your CSS file: <? Then you can use it to do all sorts of stuff: --- <? header("Content-Type: text/css"); include("../inc/colours.inc"); ?> body { background-color: #<?=$col[1]?>; color: #<?=$col[1]?>; } <? if(something) { ?> p { font-size: 110%; } <? } ?> /*etc etc*/ --- Justin French

« previous php.general (#175006) next »