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?
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?
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...
Here is the link to the about us code:
https://pasteio.com/xZBEo0Y69crI...
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()
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.
and you tried $this->inc() as well?
Yes I did
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?
Also try using $this instead of $view it might solve the problem