I’m using slim with slim/twig-view. Anyone know if is there a way to check if template exists before calling to render?
return $this->view->render($response, 'mytemplate.html', $data);
return $this->view->render($response, '404.html');
You might have to do something like this:
I ended up customising slim/twig for this reason
ok, thank @_i_g , that works for me.
You don’t mention what Slim version you are using? So I will assume its Slim3!?
If that’s the case, there’s actually a handler for this
See the official docs (they are pretty great at this)
Thank for the answer @Stjo, but that’s not my case. In my case i need to check if template exist inside one route. The route exist but i don’t know if template exist. It’s not usually case but…