0

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!

2
  • How do clients change the database? Is it a PHP script that you can modify? If so, you can hook up there and change the .css after a successful database operation. Commented Jul 10, 2011 at 16:03
  • You might look at memcache, although that may be a bit more aggressive than you need. Also, consider reviewing your codebase for things that rob performance, like using count() in a for loop, multiple database connections, and other unnecessarily heavy-handed coding practices. Commented Jul 10, 2011 at 16:07

1 Answer 1

1

Write out your CSS to a static file with fwrite:

http://www.php.net/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

Sign up to request clarification or add additional context in comments.

3 Comments

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)?
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 ...
I thought that was what you meant. :)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.