| [ Index ] |
PHP Cross Reference of Web Application Component Toolkit |
[Summary view] [Print] [Text view]
1 <?php 2 require '../load_wact.php'; 3 require WACT_ROOT . 'template/template.inc.php'; 4 require WACT_ROOT . 'request/getdata.inc.php'; 5 6 // Initialize $_GET['page'] 7 if ( !isset($_GET['page']) ) 8 $_GET['page']=1; 9 $GetDataSpace = new GetDataSpace(); 10 11 $Page =& new Template('/outputcache.html'); 12 $Page->set('Time',date('H:i:s')); 13 $Page->set('Page',$_GET['page']); 14 15 $Cache2 = & $Page->getChild('Cache2'); 16 $Cache2->import($GetDataSpace->export()); 17 18 if ( $GetDataSpace->get('flush') == 1 ) { 19 $Cache2->flushGroup(); 20 } 21 22 // Some HTTP client side caching, to save on bandwidth - this might eventually 23 // become a runtime component as well... 24 25 // Get the other two cache components 26 $caches = array(); 27 $caches['Cache1'] = & $Page->getChild('Cache1'); 28 $caches['Cache2'] = & $Cache2; 29 $caches['Cache3'] = & $Page->getChild('Cache3'); 30 31 // Find the most recent modification time of all three caches 32 $lastModified = 1; 33 foreach ( array_keys($caches) as $key ) { 34 if (($cacheModified=$caches[$key]->lastModified()) > $lastModified) 35 $lastModified = $cacheModified; 36 } 37 38 // Issue an HTTP last modified header 39 header ( 'Last-Modified: '. 40 gmdate('D, d M Y H:i:s',$lastModified).' GMT'); 41 42 // Get client headers - Apache only 43 $request = getallheaders(); 44 45 // Check to see if the client sent the If-Modified-Since header 46 if ( isset($request['If-Modified-Since']) ) { 47 // Split the If-Modified-Since (Netscape < v6 sends this incorrectly) 48 $modifiedSince = explode(';', $request['If-Modified-Since']); 49 // Turn the client request If-Modified-Since into a timestamp 50 $modifiedSince = strtotime($modifiedSince[0]); 51 52 if ($lastModified <= $modifiedSince) { 53 // Save on some bandwidth! 54 header('HTTP/1.0 304 Not Modified'); 55 die(); 56 } 57 } 58 59 $Page->display(); 60 ?>
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
| Generated: Sun Nov 28 19:36:09 2004 | Cross-referenced by PHPXref 0.5 |