Jump to content

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...
This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.