Code: Select all
var $page = 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']; // Requested page
Thanks,
Chris
Moderator: General Moderators
Code: Select all
var $page = 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']; // Requested page
Code: Select all
// Settings
var $cachedir = YB_ROOT_S.'public/cache/'; // Directory to cache files in (keep outside web root)
var $cachetime = 600; // Seconds to cache files for
var $cacheext = 'cache'; // Extension to give cached files (usually cache, htm, txt)
// Script Vars
var $page = 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']; // Requested page
var $cachefile = $this->cachedir . md5($page) . '.' . $this->cacheext; // Cache file to either load or create
// Defaults - DO NOT EDIT
var $ignore_page = false;
var $started = true;
var $cachefile;
// Ignore List
var $add_list = array(
'*.com/rss.php',
'*.com/search/'
);
function start(){
for ($i = 0; $i < count($this->add_list); $i++) {
$add_list = (strpos($this->page, $this->add_list[$i]) !== false) ? true : $this->add_list;
}
$cachefile_created = ((@file_exists($this->cachefile)) and ($this->add_list === false))
? @filemtime($this->cachefile) : 0;
@clearstatcache();
// Show file from cache if still valid
if (time() - $this->cachetime < $cachefile_created) {
//ob_start('ob_gzhandler');
@readfile($cachefile);
//ob_end_flush();
exit();
}
// we need to generate a cache file
ob_start();
}
tecktalkcm0391 wrote:cache the file with the following:
Code: Select all
// Settings var $cachedir = YB_ROOT_S.'public/cache/'; // Directory to cache files in (keep outside web root) var $cachetime = 600; // Seconds to cache files for var $cacheext = 'cache'; // Extension to give cached files (usually cache, htm, txt) // Script Vars var $page = 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']; // Requested page var $cachefile = $this->cachedir . md5($page) . '.' . $this->cacheext; // Cache file to either load or create // Defaults - DO NOT EDIT var $ignore_page = false; var $started = true; var $cachefile; // Ignore List var $add_list = array( '*.com/rss.php', '*.com/search/' ); function start(){ for ($i = 0; $i < count($this->add_list); $i++) { $add_list = (strpos($this->page, $this->add_list[$i]) !== false) ? true : $this->add_list; } $cachefile_created = ((@file_exists($this->cachefile)) and ($this->add_list === false)) ? @filemtime($this->cachefile) : 0; @clearstatcache(); // Show file from cache if still valid if (time() - $this->cachetime < $cachefile_created) { //ob_start('ob_gzhandler'); @readfile($cachefile); //ob_end_flush(); exit(); } // we need to generate a cache file ob_start(); } function finish(){ // Now the script has run, generate a new cache file $fp = @fopen($this->cachefile, 'w'); // save the contents of output buffer to the file @fwrite($fp, ob_get_contents()); @fclose($fp); ob_end_flush(); }
Code: Select all
index.php?a=b&c=d
index.php?c=d&a=b