I'm storing CSS (stylesheets) in a MySQL database, so when I call it, I only have one way, which is to echo it in the page itself. Is there anyway I can treat the database data as a .css file basically?
2 Answers
You will probably need to read the CSS once during start-up and save it to a file somewhere within your deploy folder, and then reference it in code with <link rel="stylesheet" type="text/css" href="style.css">. How exactly you do this will depend on your environment and specific web server.
In any case, it is always preferred to have the CSS as an external resource for a variety of reasons, e.g. because CSS resources are cached by the web browsers as opposed to dynamic pages.
Comments
Decided to just go with loading from a .css file it's self, thanks for the help.
header("Content-type: text/css");- then include that dynamic page where needed.