Jump to content

Create Css File in PHP


irperera

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
Link to comment
https://forums.phpfreaks.com/topic/22315-create-css-file-in-php/
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....
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.
  • 2 weeks later...

Archived

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

×
×
  • Create New...

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.