Last active
December 16, 2015 03:49
-
-
Save Tom32i/5372515 to your computer and use it in GitHub Desktop.
Twig : isoler un template lors de l'include.
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
{# template.html.twig #} | |
{% set title = 'Mon titre' %} | |
{% set username = 'Jane Doe' %} | |
<h1>{{ title }}</h1> | |
<p>{{ username }}</p> | |
{% include 'user.html.twig' with {title: username} only %} |
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
{# user.html.twig #} | |
<h2>{{ title }}</h2> | |
{# La variable title contient 'Jane Doe'. #} | |
{# La variable username n'existe pas. #} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment