Need Testers
- leigon
- World Owner
- Posts: 563
- Joined: Thu Apr 15, 2004 11:23 pm
- Location: UK - Programming under the influance.
Ok I have put all the tools I am making including the beta or the world editor on my site...
http://gyruss.no-ip.com
Please visit there and look in the "tools" section.
http://gyruss.no-ip.com
Please visit there and look in the "tools" section.
- Magicfinger
- Staff
- Posts: 1078
- Joined: Tue Sep 30, 2003 10:38 am
- Location: here,there and everywhere
quick suggestion for you leigon...
have you considered caching your page?
your page content goes here...
so basically... if the mypage.cache file exists and isds younger than the time specified then display mypage.cache as the output ... if not then run the code and save it as a new cache page.
this is what i use on the left index of the home page as it gets loads of stats from different files and can lag sometime
anyway just a suggestion
oh ... btw dont forget to set the directory to writable or it wont work
have you considered caching your page?
Code: Select all
$cachefile = 'mypage.cache';
$cachetime = 60 * 60; // 60 * number of minutes you want to cache for
// Serve from the cache if it is younger than $cachetime
if (file_exists($cachefile) && time() - $cachetime < filemtime($cachefile)) {
include($cachefile);
//echo "<!-- Cached copy, generated ".date('H:i', filemtime($cachefile))." -->\n";
}
else
{
ob_start(); // Start the output buffer
?>
Code: Select all
<?
// Cache the output to a file
$fp = fopen($cachefile, 'w');
fwrite($fp, ob_get_contents());
fclose($fp);
ob_end_flush(); // Send the output to the browser
}
?>
this is what i use on the left index of the home page as it gets loads of stats from different files and can lag sometime

anyway just a suggestion

oh ... btw dont forget to set the directory to writable or it wont work

- Magicfinger
- Staff
- Posts: 1078
- Joined: Tue Sep 30, 2003 10:38 am
- Location: here,there and everywhere
Heh, I have a thing about bumping old topics, but I spoke to Leigon about this last week...
Anyway, I was coding up a site-engine sorta thing, and I made a system where every 30 minutes [a port of] cron ran a batch file...
The batch file zipped all the files in the site-engine directory and piped phpwin.exe on a php file (the php file renamed the zip to the date and time in MySQL TIMESTAMP format, then outputted a page containing a list of the backups which had been made previously, which was loaded from another file) to an HTML file. I, of course, was too lazy to implement [a port of] diff, so I was left with like 300 identical backups, but that's another matter...Point is, the same code could help you have the stats file updated every 30 mins/hour. I'm not at home just now but I'll upload the code when I am.
Anyway, I was coding up a site-engine sorta thing, and I made a system where every 30 minutes [a port of] cron ran a batch file...
The batch file zipped all the files in the site-engine directory and piped phpwin.exe on a php file (the php file renamed the zip to the date and time in MySQL TIMESTAMP format, then outputted a page containing a list of the backups which had been made previously, which was loaded from another file) to an HTML file. I, of course, was too lazy to implement [a port of] diff, so I was left with like 300 identical backups, but that's another matter...Point is, the same code could help you have the stats file updated every 30 mins/hour. I'm not at home just now but I'll upload the code when I am.