...

View Full Version : Can you use PHP in an external CSS?



bradyj
05-11-2004, 09:04 PM
I've been using some random coding on an html document -- and to make it standard, I've been having it to randomize the colors of backgrounds and background images -- but I wasn't sure if I can put php in an external css document, so I've been placing it in the style="" section of the tag, and randomizing that.

Can it parse in an External CSS document if I just add the file extension .php instead of .css -- are there any problems with this?

Spookster
05-11-2004, 09:10 PM
As long as it has a .php extension the PHP engine will parse it, however I am not sure if the browser will parse the contents of it as an external style sheet without the .css extension.

sidney
05-11-2004, 09:34 PM
you could set the server up to parse .css

brothercake
05-11-2004, 10:11 PM
Nah I do this all the time - all you have to do is send the right content-type header:


header("Content-Type: text/css");

To save confusion, I'd give it a separate file extension like ".pcss" so you know what it is.

bradyj
05-12-2004, 12:16 AM
Nah I do this all the time - all you have to do is send the right content-type header:


header("Content-Type: text/css");

To save confusion, I'd give it a separate file extension like ".pcss" so you know what it is.

Where do I adjust this at :confused: ?

missing-score
05-12-2004, 12:23 AM
within the php script you are wanting to use as CSS.

bradyj
05-12-2004, 12:26 AM
within the php script you are wanting to use as CSS.

Ah, I see it's time for a nap -- sorry about that, I should have known. Thanks for helping me out with this guys :thumbsup:



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum