View Full Version : php in CSS
08-03-2008, 07:11 PM
i have a file is called as style.css (like following ) it is separate file (not in any file)
border: 0px solid;
some value will be read from db.for example color value is $tbl_color
is it possbile ?
08-03-2008, 08:27 PM
by making the file included, so it ran through the php parser. Thats the only way, so you will have you css printed in the source of the page.
08-03-2008, 08:53 PM
You're file will also need a .php extension or alteration in a .htaccess/http.conf file to include css as a php parsed file. I'd recommend sending a header at the top of you're css as well:
This way you do not need to include the file as long as its independent (doesn't rely on anything generated in another file, or uses the same file as another file), and you should be able to call it the same way:
<link rel="stylesheet" type="text/css" href="mycss.php" />
Been awhile since I've used an external stylesheet with php, but I seem to recall doing it this way and it worked no problems.
Powered by vBulletin® Version 4.2.2 Copyright © 2017 vBulletin Solutions, Inc. All rights reserved.