I have a css style under php to execute some functions and sql connections, because the client needs to update a database everyday in the morning and change some css style too, so the problem is that a css with php is too slow so I need that whenever the sql database is modify the style.php creates a new static version of style.css , and the same must happend with all the pages that do sql requests. In the end is a cache I guess, where all dinamycs pages get converted to a static version everytime the database it's updated. And the clients will only visit the static versions of the pages. How can I do that??. Bye!
1 Answer
Write out your CSS to a static file with fwrite:
Plenty of examples on the PHP site and other information to read
To clarify ... you say you provide a dynamic CSS from a PHP file ... it makes more sense if this isn't a good solution for you, to write out the CSS to a static CSS file
3 Comments
Jared Farrish
Do you mean write out the css file when changed by the client, then point the browser to that css file when someone accesses the site (so the php file is never seen by the end-user)?
sdolgy
yes. have it dump out to file after they make the changes every morning...your browser then should be accessing the static CSS and not the dynamic php css ...
Jared Farrish
I thought that was what you meant. :)
count()in a for loop, multiple database connections, and other unnecessarily heavy-handed coding practices.