I would like to create a cache for my php pages on my site. I did find too many solutions but what I want is a script which can generate an HTML page from my database ex:
I have a page for categories which grabs all the categories from the DB, so the script should be able to generate an HTML page of the sort: my-categories.html. then if I choose a category I should get a my-x-category.html page and so on and so forth for other categories and sub categories.
I can see that some web sites have got URLs like: wwww.the-web-site.com/the-page-ex.html
even though they are dynamic.
thanks a lot for help
In my opinion this is the best solution. I use this for cache JSON file for my Android App. It can be simply use in other PHP files. It's optimize file size from ~1mb to ~163kb (gzip).
Create
cache
folder in your directoryThen Create
cache_start.php
file and paste this codeCreate
cache_end.php
and paste this codeThen create for example
index.php
(file which you want to cache)You can get URLs like that using URL rewriting. Eg: for apache, see mod_rewrite
http://httpd.apache.org/docs/2.2/mod/mod_rewrite.html
You don't actually need to be creating the files. You could create the files, but its more complicated as you need to decide when to update them if the data changes.