[Phplib-users] Template and PHP3?
Brought to you by:
nhruby,
richardarcher
|
From: Peter B. <re...@f2...> - 2001-09-13 18:49:35
|
Hi,
I am having problems getting template.inc working with PHP3 - although it's
probably my code at fault :-)
I have the following subclass:
Class Sendcard_Template extends Template {
/*
* private:
*/
function del_block($container, $handle) {
$this->set_block($container, $handle);
$this->set_var($handle, "");
}
/***************************************************************************/
/* private: loadfile(string $varname)
* varname: load file defined by varname, if it is not loaded yet.
*/
function loadfile($varname) {
if (!isset($this->file[$varname])) {
// $varname does not reference a file so return
return true;
}
if (isset($this->varvals[$varname])) {
// will only be unset if varname was created with set_file and has
never been loaded
// $varname has already been loaded so return
return true;
}
$filename = $this->file[$varname];
/* use @file here to avoid leaking filesystem information if there is
an error */
// $str = implode("", @file($filename));
if (floor(phpversion()) == 3) {
$str = implode("", @file($filename));
} else {
$str = _parseFile($filename);
}
if (empty($str)) {
$this->halt("loadfile: While loading $varname, $filename does not
exist or is empty.");
return false;
}
$this->set_var($varname, $str);
return true;
}
} // End Class Sendcard_Template
========================================================
When called, as per:
$tpl = new Sendcard_Template($tpl_path);
--oOo--
Narrow Gauge on the web - photos, directory and forums!
http://www.narrow-gauge.co.uk
--oOo--
Peter's web page - Scottish narrow gauge in 009
http://members.aol.com/reywob/
--oOo--
|