I'm trying to make custom error pages in symfony2 but having problems using my site theme/layout within error.html.twig
As in stated here: http://symfony.com/doc/current/cookbook/controller/error_pages.html
I've overridden the error file and put my own into app/Resources/TwigBundle/views/Exception/error.html.twig
. If I use static content this all works fine, but I'd like to use {% extends '::base.html.twig' %}
like I do with all other pages, so I can copy my current layout and styles.
base.html.twig is located at app/Resources/views/base.html.twig
. How do I go about extending this template?
Also, just out of curiosity, is there any way of overriding error pages from within one of my bundles without making a 'TwigBundle' bundle especially for it?
UPDATE
Ok, solved this with the help of 'wouter J'. It turns out the file was being found but the file it was extending was using is_granted. Adding app.user and
to the if statement as it says in the docs solved it.