Template: use include path for set_file
Brought to you by:
nhruby,
richardarcher
Allows the use of the include path rather than absolute
or relative filenames in Template::load_file().
Use:
Add the $use_inc_path class variable and replace
Template(), set_file(), and load_file() methods with those
in the attached template.inc.patch file below.
Be sure to add your template directory to your include
path.
Example of use after patch:
$pg = new Template("USE_INC_PATH");
$pg->set_file("filename.tpl");
filename.tpl only needs to be in your include path now
not in current working directory. The same code will
work in any directory this way.
Patch to allow use of include path for Template::load_file()
Logged In: YES
user_id=598737
Oops! The new class variable, $use_inc_path, should not be
set to anything in its declaration. It is set in the new
constructor. So it should read
var $use_inc_path;
rather than
var $use_inc_path = ".";
Thats what I get for using copy and paste too much. :o)
Logged In: YES
user_id=598737
Also, in my example for use after the patch the second line
should read
$pg->set_file("varname", "filename.tpl");
I'm gonna go get some rest now. :o)