Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Repetir el contenido de un bloque dentro de una plantilla twig
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8" />
<title>{% block pagetitle %}{{ block('title') }} | MyPage{% endblock %}</title>
{% block stylesheets %}{% endblock %}
<link rel="icon" type="image/x-icon" href="{{ asset('favicon.ico') }}" />
<meta name="title" content="{% block metatitle %}{{ block('title') }} | MyPage{% endblock %}"/>
</head>
<body>
<h1>{% block title %}Bienvenido a mi blog!{% endblock %}</h1>
{% block body %}{% endblock %}
{% block javascripts %}{% endblock %}
</body>
</html>
{% extends 'base.html.twig' %}
{% block title %}Usos de la función block en twig{% endblock %}
{% block metatitle %}Podemos personalizar cualquier bloque de forma independiente{% endblock %}
{% block body %}
{# nuestro contenido #}
{% endblock %}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.