Jump to content

Archived

This topic is now archived and is closed to further replies.

irperera

Create Css File in PHP

Recommended Posts

I'm creating a menu that uses css and mysql database. I have everything working, expect the fact that i need to go in manual and change or add css styles. what i would like to do is find out how to make php create a css file and input style where needed. can someone point me into the correct direction?

irperera

Share this post


Link to post
Share on other sites
You could set the href of you css in the link tag to a php script which would output css.

OR

you could use php to edit the css file. To do this you will need file_get_contents and file_put contents (or the fopen fread fput fclose equivalnet) and to develop a method of finding the relevant lines in the css....

Share this post


Link to post
Share on other sites
make a regular php file, and put it as
<a href="style.php" rel="stylesheet" type="text/css" />
it works perfectly if
1. you send a css header using php to the browser
2. you make sure everything that outputs from the php is valid css, same for javascript files.

Share this post


Link to post
Share on other sites
You could just embed the CSS and use php to echo the styles.  Then you could pull from a database or SESSION.

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.