getting error that a template that extends can not have body

Rohitashv Singhal picture Rohitashv Singhal · Jul 31, 2012 · Viewed 32.7k times · Source

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 -->

Answer

Vitalii Zurian picture Vitalii Zurian · Jul 31, 2012

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