Repetir el contenido de un bloque dentro de una plantilla twig
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!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> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{% 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