FrostbiteXIII Posted November 14, 2006 Share Posted November 14, 2006 Is there any way to create dynamic (server side) css?Like a php file that can be linked to css-style?Not that I have tried exactly that, but even if this kinda thing works is it 'proper'? Link to comment Share on other sites More sharing options...
boen_robot Posted November 14, 2006 Share Posted November 14, 2006 It's not exactly a good practice, but yes... it's possible.PHP's output can be anything you want, so it doesn't really matter what it looks in the end.Let's say that with a PHP file, you create the CSS file "style.php". When displayed in a browser, it's plain text. Even though this file has a PHP extension, all the browser really cares for is the MIME type, specified in (X)HTML:<link rel="stylesheet" type="text/css" href="style.php" />and/or in the PHP file itself, sent with the header() function: header("Content-type: text/css") Link to comment Share on other sites More sharing options...
FrostbiteXIII Posted November 18, 2006 Author Share Posted November 18, 2006 It's not exactly a good practice, but yes... it's possible.PHP's output can be anything you want, so it doesn't really matter what it looks in the end.Let's say that with a PHP file, you create the CSS file "style.php". When displayed in a browser, it's plain text. Even though this file has a PHP extension, all the browser really cares for is the MIME type, specified in (X)HTML:<link rel="stylesheet" type="text/css" href="style.php" />and/or in the PHP file itself, sent with the header() function:header("Content-type: text/css") Thanks Boen Robot! Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now