» Quick Links
You can make money on these forums
We Share profits with you
Google
Google Adsense
Google Adwords
YPN
Yahoo
MSN Search
Web Directories
Web Hosting
Web Hosting Offers
Hosting News
Suggestions
Link Building
Domain Names
PHP Forums
MySQL Forums
» More Links
OSP News
Reseller Hosting
Shared Hosting
Dedicated Servers
Google Adsense
Search Engine Marketing
Link Development
Affiliate Marketing


» Advertising
Multiple DC PR Check

Free SEO Tools


Go Back   Webmaster Forums > Website Developement / Programming > PHP Programming and Tips

PHP Programming and Tips Discuss about PHP programming and Share Tips. Ask questions about Scripting and Errors.

Reply
 
Thread Tools Display Modes
  #1  
Old 12-07-2005, 06:02 AM
johny johny is offline
OSP Starters
 
Join Date: Dec 2005
Posts: 15
Thanks: 0
Thanked 0 Times in 0 Posts
Rep Power: 0
johny is on a distinguished road
Default PHP Caching

I have set the following properties in order to speed up my pages:

ob_start("ob_gzhandler");

The problem is I have a user profile page and when the user updates their picture, the new one won't show up unless they refresh the page. Even when the click on the picture which is pointing to a .jpg file, it shows the old .jpg file from cache unless they refresh that page as well.

How can i cache the php pages so it loads faster, but on certain pages remove this cache so it reloads everytime

Thanks -- This message may have been cut off and the rest will only be shown to members. To become a member, click here --
Reply With Quote
Revenue Sharing Ads ( ?):
  #2  
Old 12-07-2005, 06:06 AM
maddy maddy is offline
OSP Starters
 
Join Date: Dec 2005
Posts: 9
Thanks: 0
Thanked 0 Times in 0 Posts
Rep Power: 0
maddy is on a distinguished road
Default Implementing a Cache

There are various ways of implementing a cache to do this, but the easiest to implement (if maybe not the most efficient) is to use a bit of extra PHP code in your scripts. Most of this example is based on this site, but could easily be applied to any site.

For the purposes of this example it helps to have a small understanding of my website. Basically each page location (e.g. "site/caching") has each / replaced by a . and that file (which contains all the content) is included into the template (so includes/design.caching in this case). The actual filename ends up in a variable called $reqfilename.

Lets look at the most basic, and rather useless, cache. This little snippet of code will save the output of a call for the "home" page into a file called home.html
<?php
// start the output buffer
ob_start(); ?>

//Your usual PHP script and HTML here ...

<?php
$cachefile = &q -- This message may have been cut off and the rest will only be shown to members. To become a member, click here --
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
i can help with php averagejoe Advertise Programming Services 1 02-25-2007 03:48 AM
Modwest Offers Live PHP Tool outsourcingplans Web Hosting News 0 12-16-2006 02:24 AM
Is PHP loosing out to .NET? garcia PHP Programming and Tips 1 08-10-2006 01:44 PM
Recompiling PHP, Fedora 4 jhingalala PHP Programming and Tips 1 07-17-2006 01:47 PM
Getting MySQL & PHP to communicate JCH MySQL Forums 0 05-29-2006 01:52 PM


All times are GMT. The time now is 02:57 AM.