here is the part if having error.
Fatal error: Using $this when not in object context in /pb_events.php on line 6
line 6 is: $jpp = $this->vars->data["jpp"];
function DoEvents($this) {
global $_CONF, $_PAGE, $_TSM , $base;
$jpp = $this->vars->data["jpp"];
$cache["departments"] = $this->db->QFetchRowArray("SELECT * FROM {$this->tables[job_departments]}");
$cache["locations"] = $this->db->QFetchRowArray("SELECT * FROM {$this->tables[job_location]}");
$cache["names"] = $this->db->QFetchRowArray("SELECT * FROM {$this->tables[job_names]}");
$cache["categories"] = $this->db->QFetchRowArray("SELECT * FROM {$this->tables[job_categories]}");
Thanks a lot! appreciate!
You can't use $this inside a static function, because static functions are independent of any instantiated object. Try making the function not static. Edit: By definition, static methods can be called without any instantiated object, and thus there is no meaningful use of $this inside a static method.
$this is a reserved keyword in PHP that refers to the calling object. It is usually the object to which the method belongs, but possibly another object if the method is called statically from the context of a secondary object.
self is used to access static or class variables or methods and this is used to access non-static or object variables or methods. So use self when there is a need to access something which belongs to a class and use $this when there is a need to access a property belonging to the object of the class.
$this only makes sense in methods, not in functions
this is ok
class Foo {
function bar() {
$this->...
this is not
function some() {
$this->
// edit: didn't notice he passes "$this" as parameter
advice: simply replace "$this" with "$somethingElse"
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With