# them is run
require_once('code/wfpl/encode.php');
-require_once('code/wfpl/misc.php'); # to get read_whole_file()
+require_once('code/wfpl/misc.php');
+require_once('code/wfpl/file.php');
class tem {
var $keyval; # an array containing key/value pairs
# Run the template. Pass a filename, or a string, unless you've already
# specified a template with load()
function run($templ = false) {
+ $template_string = $this->template;
+ $template_file = $this->file;
if($templ !== false) {
if(strlen($templ) < 150 && file_exists($templ)) {
- $this->filename = $templ;
- unset($this->template);
+ $template_file = $templ;
+ unset($template_string);
} else {
- $this->template = $templ;
+ $template_string = $templ;
}
}
- if(!$this->template) {
- if(!$this->filename) {
+ if(!$template_string) {
+ if(!$template_file) {
print "sorry, no template to run\n";
exit(1);
}
- $this->template = read_whole_file($this->filename);
+ $template_string = read_whole_file($template_file);
}
- return template_run($this->template, $this->keyval);
+ return template_run($template_string, $this->keyval);
}
# same as run() except the output is print()ed