Fatal error: Uncaught Error: Call to a member function inc() on null

Permalink
Hello, Please I need your help on a pressing problem using the concrete5 platform. I tried to include some files from my element directory but I get this error:

Fatal error: Uncaught Error: Call to a member function inc() on null

Including the file using the below syntax works perfectly in my full.php page but when it comes to the about us page I get the above error.

<?php

$view->inc('elements/header.php');
$view->inc('elements/mobile.php');
$view->inc('elements/search.php');

?>

Please what am I doing wrong or omitting?

 
mnakalay replied on at Permalink Reply
mnakalay
If this code works elsewhere then the problem is not in that code but in another piece of code. It would be helpful if you could share the whole about us template code.

Also try using $this instead of $view it might solve the problem
vhiktordom replied on at Permalink Reply
Thanks for replying. I tried using $this but it threw a different set of error to me.
Here is the link to the about us code:
https://pasteio.com/xZBEo0Y69crI...
mnakalay replied on at Permalink Reply
mnakalay
I am a bit confused. In the code you sent you are using both $view and $this->view. It should be either $view->inc() for all or $this->inc() for all but not $this->view->inc()
vhiktordom replied on at Permalink Reply
Sorry about that, I was formerly trying to test the two to check which one works. But I did try each one of them though.
mnakalay replied on at Permalink Reply
mnakalay
and you tried $this->inc() as well?
vhiktordom replied on at Permalink Reply
Yes I did
mnakalay replied on at Permalink Reply
mnakalay
ok. Well I don't see anything wrong with your code, it's pretty straightforward, the issue might be elsewhere. Could you share the whole theme to have a look?