supernaturall
supernaturall

Reputation: 58

symfony2 customise error page and extend

I'm currently stuck with something that sounds really easy : "customize error pages".

I followed the s2 sample to customize these pases ie :

  1. Create a new folder app/Resources/TwigBundle/views/Exception
  2. c/c the error.html.twig and exception.html.twig from the TwigBundle folder to the new one

At this point it works. I remove everything from the templates and write a simply "hello world", and once I try to reach a non existing page I have my template.

My problem is when I try to use the template developed for my website.

My base template is locate here :

webApp/app/Resources/views/Frontend/base.html.twig

when I try to use this template I have a Route Not found exception. Here the extends that I tried to use :

{%  extends ":Frontend:base.html.twig" %}
{%  extends "::Frontend:base.html.twig" %}

Do you have any idea how to fix that ? Or if it's possible to extend the error templates ?

Many thanks,

Upvotes: 0

Views: 167

Answers (2)

devilcius
devilcius

Reputation: 1884

I would put base.html.twig in webApp/app/Resources/views/base.html.twig and then extend it with

{% extends "::base.html.twig" %}

Probably I'm missing something, but why would you have Frontend folder in webApp/app/Resources/views/? Like if there were a controller named Frontend?

Upvotes: 1

Igor Pantović
Igor Pantović

Reputation: 9246

In your case it should be:

{% extends "Frontend::base.html.twig" %}

Upvotes: 0

Related Questions