Good morning all
after a lot of search on the forum and google
and the doc of slim v4 impossible to display my templates I would like your light big thank you. (even if the subject has already been mentioned)
Hi @djo, welcome!
The simple answer is that you’re trying to call the
render() method on
$this->view, but if you notice you haven’t defined it in your constructor. You have two choices:
- Add a
private $view; property at the top of your class and in your constructor add
$this->view = $container->get('view'); (working from memory, but I think that’s right)
- Or, in your
homePage() method, change
There’s a bigger piece where we don’t recommend that you inject the entire container, preferring to inject the dependencies themselves, but you appear to be using larger controllers, rather than dedicated action classes, so that will be a bit laborious. Also, if you’re using a container that supports auto-wiring (it looks like you’re using PHPDI, which does), you won’t get the best from it this way.
This is for another topic, though
I hope that helps.
thanks for your help really
and I take note for the container
I started on slim but thanks for the advice