Recently i found a Post about Etags and thought this will be usefull for bandwith saving and faster response times in my scripts.
Just use this nice function:
function deliver_content($content) { $etag = '"' . md5($content) . '"'; if (!isset($_SERVER['HTTP_IF_NONE_MATCH'])) { $_SERVER['HTTP_IF_NONE_MATCH'] = ''; } header('Cache-Control: must-revalidate, proxy-revalidate'); header('ETag: ' . $etag); if ($_SERVER['HTTP_IF_NONE_MATCH'] == $etag) { header('HTTP/1.0 304 Not Modified'); } else { echo $content; } }
So all your content of this site will be cached in the browser cache, until the etag differs. I just used an md5 of the content, but you could use also other strings.