First, make sure, that you include the class file before using it:
include_once 'path/to/tpl_functions.php';
This should be done either in your index.php or on top of the class which uses tpl_function. Also note the possibility of autoloading classes:
Since PHP5 you have to possibility to autoload classes. This means you register a hook function that is been called everytime when you try to use a class which's code file hasn't been included yet. Doing it you won't need to have include_once statements in every class file. Here comes an example:
index.php or whatever application entry point:
spl_autoload_register('autoloader');
function autoloader($classname) {
include_once 'path/to/class.files/' . $classname . '.php';
}
From now on you can access the classes without to worry about including the code files anymore. Try it:
$process = new process();
Knowing this, there are several ways how you can use the template_functions class
Just use it:
You can access the class in any part of the code if you create an instance of it:
class process
{
//all process with system and db
public function doSomethging() {
// create instance and use it
$tplFunctions = new template_functions();
$tplFunctions->doSomethingElse();
}
}
Instance members:
Take the process class for example. To make the template_functions available inside the process class, you create an instance member and initialize it somewhere, where you need it, the constructor seems to be a good place:
//CMS System class
class process
{
//all process with system and db
// declare instance var
protected tplFunctions;
public function __construct() {
$this->tplFunctions = new template_functions;
}
// use the member :
public function doSomething() {
$this->tplFunctions->doSomething();
}
public function doSomethingElse() {
$this->tplFunctions->doSomethingElse();
}
}