In short.. question is... \"Say what?\" To expand... \"I don\'t get the error\"
Strict Standards: Non-static method Pyro\\Template::preLoad() should not b
Like everyone said, the you called the function with as a static method:
Template::preLoad(xxx)
The ::
means static in PHP. Functions are typically called as static ::
or object ->
calls.
The function definition is one or the other:
public static function preLoad($template, $page)
Called like: Template::preLoad('admin/courses/index', $this->data);
OR
public function preLoad($template, $page)
Called like Template->preLoad('admin/courses/index', $this->data);
For reference, a static function is able to be called without instantiating an object. If your function doesn't need an object to run, you could make it static. Basically, this means you can't reference $this
in a static method. It will run with the given inputs without having to construct the object.
preLoad
function should be static
public static function preLoad($template, $page) {
Well the preLoad function is not static. Which means only an object of the class Template can use this method. A static method exists indepedently of any object of the class.
Template::preLoad is a static call : you didn't create a Template object, then call the preLoad method. So basically, you've got two solutions :
preLoad function isn't static. ti should look like this:
public static function preLoad($template, $page) {
ob_start();
include( VIEWS . "{$template}.php");
$buffer = ob_get_contents();
@ob_end_clean();
return $buffer;
}