eZ Community » Forums » eZ Platform » customize error handling with ez...
expandshrink

customize error handling with ez platform

customize error handling with ez platform

Thursday 03 November 2016 2:44:13 pm - 4 replies

Hi,

I try to customize the error pages (404 - not found and 403 - access denied) with ezplatform but I do not understand how it works. I tried to follow the symfony instructions here : http://symfony.com/doc/2.0/cookbook/controller/error_pages.html

... but It does not seem to work.

Could someone explain me how to do this ?

Best regards

Olivier 

Friday 03 February 2017 12:34:12 pm

Hi

Nobody knows how to customize error pages with ezplatform ??

Regards

Olivier 

Thursday 16 February 2017 9:38:14 pm

You can override default twig templates in this path : app/Resources/TwigBundle/views/Exception/

as explained here : https://symfony.com/doc/2.8/controller/error_pages.html#overriding-the-default-error-templates

Friday 03 March 2017 3:31:02 pm

Hi Matthieu,

Thank you for you help. It works !!

However, as all my website is in a separate bundle, I would like to put this overriding files too, in order to keep the same look&feel for error pages.

But I cannot find where. 

Actually, I wonder if it is even possible...

I tried :

src/MyBundle/SiteBundle/Twig/Resources/TwigBundle/views/Exception/error403.html.twig

src/MyBundle/SiteBundle/Twig/Exception/error403.html.twig

src/MyBundle/SiteBundle/Resources/TwigBundle/views/Exception/error403.html.twig

src/MyBundle/SiteBundle/Resources/views/Exception/error403.html.twig

src/MyBundle/TwigBundle/views/Exception/error403.html.twig

I declared the TwigBundle as the parent of MyBundle as suggested here  https://symfony.com/doc/2.8/bundles/inheritance.html

But nothing works...

Would you have an idea ?

Best regards,

Olivier

Modified on Friday 03 March 2017 3:31:42 pm by LOBRY Olivier

Saturday 04 March 2017 7:33:45 am

Hello Lobry,

We recently were working with this same problem and developed a solution which provides for the end goals of what your looking for while working within what seems to be a rather nasty case of the limitations of symonfy (atm).

Checkout our solution, https://github.com/brookinsconsulting/BcErrorPagesBundle

In short we provide a script which creates a symbolic link from the installed composer bundle template directory into the app/Resources directory structure. We think this is a simple workaround to the problems you have encountered. BTW, we tried reaching out to others in the symfony chat channel on freenode but at the time of this post did not receive a reply to the question, "Can you store error page template overrides within a bundle" which to date we have not seen any proof that that question has any kind of yes answer except the one we created with BcErrorPagesBundle. 

We hope this helps!
Cheers,
Heath

expandshrink

You must be logged in to post messages in this topic!

36 542 Users on board!

Forums menu

Proudly Developed with from