Chesso 0 Report post Posted May 29, 2007 I am hopefully about to attempt this on the news page of my new site.Every bit counts as far as I'm concerned and not having "news" portion of my news page re-php and re-mysql everything where there is no chance seems like a waste.I'm looking for good articles, information or tips on the process (if I fail to find any good information as I'm looking through now).The way I see it right now, I have most of my page split up in header, content (some static html in here before dynamic contend and then a little more static html to close it off) and then a footer (using PHP includes to bring them all together).So I want to include a static html representation of the actual news portion of the news page from say a cache directory (for the sake of not having too much junk in one place, and I might use this for other pages as well), and only update that cache when I make a new news post from the administration section (which I am building soon, have done several before).The news has pagination (if too many news posts on a single page it spans to multiple ones) though this isn't necessary and I may consider removing this feature to simplify things.But yeah, I would basically instead of generating the news content from PHP/mySQL, in the admin section take a very similar approach but instead write the data to my static html cache page.How does that sound (and is there anything I need to consider aside from what I have mentioned already)?Any help is greatly appreciated! Share this post Link to post Share on other sites
TavoxPeru 0 Report post Posted May 30, 2007 I am hopefully about to attempt this on the news page of my new site.Every bit counts as far as I'm concerned and not having "news" portion of my news page re-php and re-mysql everything where there is no chance seems like a waste.I'm looking for good articles, information or tips on the process (if I fail to find any good information as I'm looking through now).The way I see it right now, I have most of my page split up in header, content (some static html in here before dynamic contend and then a little more static html to close it off) and then a footer (using PHP includes to bring them all together).So I want to include a static html representation of the actual news portion of the news page from say a cache directory (for the sake of not having too much junk in one place, and I might use this for other pages as well), and only update that cache when I make a new news post from the administration section (which I am building soon, have done several before).The news has pagination (if too many news posts on a single page it spans to multiple ones) though this isn't necessary and I may consider removing this feature to simplify things.But yeah, I would basically instead of generating the news content from PHP/mySQL, in the admin section take a very similar approach but instead write the data to my static html cache page.How does that sound (and is there anything I need to consider aside from what I have mentioned already)?Any help is greatly appreciated!You are lucky, yesterday searching for some information related to how to implement Form's Inline Edition i read an article about this, it's a bit older but i think it could help you, you can read it at Use Cache to Speed up webserver, this article includes a PHP/MySql example of this technique, and also, in the same page you can find a simple way to implement inline edition with Ajax.Best regards, Share this post Link to post Share on other sites
Chesso 0 Report post Posted May 30, 2007 Ahh awesome that should help.I found a similar article last night (slightly different coding approach though), but this seems to be the basic idea I am looking for.Unfortunately I can't really get started until I have at least basic site administration up, because that's the point where the cache will be created/updated.Seen as I may be running a php/mysql driven browser game in the future, it can really help if small places like news and such aren't killing the server or database . Share this post Link to post Share on other sites
mortalmatt 0 Report post Posted May 30, 2007 Awesome man! thanks for the URL. This is a new idea to me to cache the MySQL queries. I will definitely implement it or give it a shot on my project, because I am using a lot of queries. I want to save as much bandwidth and make it as quick for the user as possible. Share this post Link to post Share on other sites
Chesso 0 Report post Posted May 30, 2007 Hi matt, I have already implemented it for my new site, and it's not too difficult.On my news page, I basically check if a cache file (news_cache.htm) already exists, if it does not I flush buffer (cause I already was bufferning), re-start buffering, output a new news page based on the normal querying, get the buffer at the end, flush it, then write it to cache file.From then on it will load from the cache until the cache is removed.Where I simply delete the cache file, within my administration section if I Add/Edit or Remove any news piece.Hope that helps! Share this post Link to post Share on other sites