0

Correct me If I wrong but It is not possible to use html code outside of block from the inheriting layout, right?

Here is what I mean

{# app/Resources/view/base.html.twig #}
<!DOCTYPE html>
......
<% block sidebar %>
<h1>...</h1>
<% endblock; %>

{# src/Acme/CoolBundle/Controller/page.html.twig #}
{% extends '::base.html.twig' %}

{% block sidebar %}
 {{ parent{} }}
 <p>Lorem ipsum bla bla.. </p> // This one  works and the paragraph is rendered
{% endblock }
<h3>Latest news</h3> // Here I get A template that extends another one cannot have a body in...
objc_bd
  • 247
  • 1
  • 4
  • 11
  • You need to add another (empty) block to your base.html.twig for your latest news section. You can add as many placeholder blocks to your base as you like for optional content - inheriting pages can just fill in the ones they need. – redbirdo Oct 03 '13 at 17:08

1 Answers1

0

You're right (this time ;) ). It's not possible to put html outside blocks in templates that extends others.

Elon Than
  • 9,603
  • 4
  • 27
  • 37