Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

getting error that a template that extends can not have body

Tags:

twig

symfony

I am working on jobeet tutorial. When I am running the project on localhost like this:

http://localhost/Symfony/web/app_dev.php/ens_job/ 

I am getting a error

A template that extends another one cannot have a body in EnslJobeetBundle:Job:index.html.twig at line 7. 

What should I do in this case?

I am using the index.html.twig as follow:

<!-- src/Ens/JobeetBundle/Resources/views/Job/index.html.twig --> {% extends 'EnsJobeetBundle::layout.html.twig' %}  {% block stylesheets %}   {{ parent() }}   <link rel="stylesheet" href="{{ asset('bundles/ensjobeet/css/jobs.css') }}" type="text/css" media="all" /> {% endblock %}  <!-- the rest of the code --> 
like image 405
Rohitashv Singhal Avatar asked Jul 31 '12 11:07

Rohitashv Singhal


1 Answers

This error occurs when you have content out of blocks in child template.

You have to remove <!-- src/Ensl/JobeetBundle/Resources/views/Job/index.html.twig --> from your index.html.twig

like image 196
Vitalii Zurian Avatar answered Sep 29 '22 13:09

Vitalii Zurian