How to expand the branch template in the same directory of my other templates?

I have index.html.twig and base.html.twig in the same directory folder. I have the following scripts

index.html.twig

{% extends('base.html.twig') %} {% block body %} helo body {{ parent() }} {% endblock %} {% block footer %} This footer {% endblock %} 

base.html.twig

 <!DOCTYPE html> <html> <head> <meta charset="UTF-8" /> <title>{% block title %}Welcome!{% endblock %}</title> {% block stylesheets %}{% endblock %} <link rel="icon" type="image/x-icon" href="{{ asset('favicon.ico') }}" /> </head> <body> {% block body %}The body block{% endblock %} {% block sidebar %}The body sidebar{% endblock %} </body> </html> 

It returns me with the error โ€œCould not find the templateโ€œ base.html.twig โ€inโ€œ FacebookBundle: Default: index.html.twig. โ€I also noticed that some people used :: just before the template name. Why and how to fix it?

+4
source share
1 answer

You need to extend FacebookBundle:Default:base.html.twig to index.html.twig .

You use :: when you put your template directly in the view/ directory, and not in a subdirectory (i.e.: for the layout in this example: Bundle::layout.html.twig instead of Bundle:Controller:index.html.twig )

 Bundle Resources views Controller index.html.twig Default base.html.twig index.html.twig layout.html.twig 
+14
source

All Articles