Bman900 Posted May 4, 2009 Share Posted May 4, 2009 Basicly I have an admin panel where I want to edit certain colors in a .css file. Can I include PHP in the .css to make this work? Quote Link to comment https://forums.phpfreaks.com/topic/156727-edit-css-file-in-php/ Share on other sites More sharing options...
hchsk Posted May 4, 2009 Share Posted May 4, 2009 do it the opposite way, use php to modify element.styles.thestyleyouwanttochange a quick google of "php how to change css style" would pull up endless tutorials, explanations Quote Link to comment https://forums.phpfreaks.com/topic/156727-edit-css-file-in-php/#findComment-825285 Share on other sites More sharing options...
Ken2k7 Posted May 4, 2009 Share Posted May 4, 2009 hchsk, PHP can do that? Isn't that JavaScript? Well you can have PHP open the CSS file and dump the value into a textarea for you to edit. Quote Link to comment https://forums.phpfreaks.com/topic/156727-edit-css-file-in-php/#findComment-825286 Share on other sites More sharing options...
hchsk Posted May 4, 2009 Share Posted May 4, 2009 yeahhhhh. . . youre right ken, i keep answering too quickly and giving stupid answers, sorry bman. you can definitely include multiple style sheets, and use php to switch the sheet whenever you want, but that might not be exactly what you're asking. kens answer is clever, then use stristr or strstr substr and str_replace to do what you need to do, and fwrite over the file Quote Link to comment https://forums.phpfreaks.com/topic/156727-edit-css-file-in-php/#findComment-825293 Share on other sites More sharing options...
Bman900 Posted May 4, 2009 Author Share Posted May 4, 2009 Well I want to make it simple for the user. Basically this is what I want to do: .css file #header { color: #003399; background: #8CA8E6; } And then my admin panel would have: Backround: ___________ SUBMIT Can this be done in .css? <?php $backround = "#8CA8E6"; ?> #header { color: #003399; background: <?php echo"$backround"; ?>; } Quote Link to comment https://forums.phpfreaks.com/topic/156727-edit-css-file-in-php/#findComment-825296 Share on other sites More sharing options...
DarkSuperHero Posted May 4, 2009 Share Posted May 4, 2009 Heres a quick tutotial on doing just that... ;-) http://www.barelyfitz.com/projects/csscolor/ Quote Link to comment https://forums.phpfreaks.com/topic/156727-edit-css-file-in-php/#findComment-825298 Share on other sites More sharing options...
Bman900 Posted May 4, 2009 Author Share Posted May 4, 2009 Heres a quick tutotial on doing just that... ;-) http://www.barelyfitz.com/projects/csscolor/ PERFECT! Thank you! Quote Link to comment https://forums.phpfreaks.com/topic/156727-edit-css-file-in-php/#findComment-825300 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.