To Till,
Your arguments are cogent enough, much better than winking. I didn't
know that about the cache. I'll keep it in mind. That whole segment was
cut and pasted out of my bootstrap file. Somehow I missed deleting it
when I sanitized it for public viewing. As for the Global, I generally
agree with you, but this global is different, it has superpowers.;)
I'll include the code. You can wink at it all you like, it isn't mine.
I pinched it off the net.
pat
<?php
define("APP_DATA_FILE",realpath(make_private_path("/app/data/application.data")));
function application_start ()
{
global $_APP;
// if data file exists, load application
// variables
if (file_exists(APP_DATA_FILE))
{
// read data file
$file = fopen(APP_DATA_FILE, "r");
if ($file)
{
$data = fread($file,
filesize(APP_DATA_FILE));
fclose($file);
}
// build application variables from
// data file
$_APP = unserialize($data);
}
}
function application_end ()
{
global $_APP;
// write application data to file
$data = serialize($_APP);
$file = fopen(APP_DATA_FILE, "w+");
if ($file)
{
fwrite($file, $data);
fclose($file);
}
}
?>