When i tried to use this code, i am facing an error.
My Code :
require_once 'functions/general.functions.inc';
class AccessingNodes {
function getNodeId($parent_id){
$node_id = $this->getNodeIdByParentId($parent_id); // This function is defined in general.functions.inc file
return $node_id;
}
}
I can’t access a function of that included file. It gives me an error.
Error :
Fatal Error Call to undefined method
AccessingNodes::getNodeIdByParentId
The general.functions.inc is defined by some one. I don’t know what is missing here. I got answer for my previous post in SO. In that, it was said that we can treat .inc file’s functions as own function of the file. So i called the function using $this operator.
Anyone please guide me to overcome this.
The .inc file functions can be treat as own functions of the file but not as own functions of the class.
Remove the $this and the code should work.