Last active
August 29, 2015 13:58
-
-
Save GromNaN/10370709 to your computer and use it in GitHub Desktop.
Twig issue #1378
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> | |
<title>{% block title %}{% endblock %}</title> | |
{% block head %} | |
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-15" /> | |
{% endblock %} | |
</head> | |
<body> | |
{% block header %}{% endblock %} | |
<div id="page"> | |
{% block body %}{% endblock %} | |
</div> | |
<div id="footer"> | |
{% block footer %}{% endblock %} | |
</div> | |
{% block scripts %}{% 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
{% block title %}My content title{% endblock %} | |
{% block head %} | |
{# {{ parent() }} Not working #} | |
<meta property="og:image" content="http://static.lexpress.fr/pub/lexpress_fb.jpg" /> | |
{% endblock %} | |
{% block body %} | |
{# {% import 'macros.twig' as macros %} #} | |
{% from 'macros.twig' import breadcrumb as breadcrumb %} | |
{{ breadcrumb([{url:'/',title:'1'}, {url:'/',title:'2'}]) }} | |
{% endblock %} |
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
{ | |
"require": { | |
"twig/twig": "~1.13.0" | |
} | |
} |
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
<?php | |
ini_set('display_errors', 1); | |
require __DIR__.'/vendor/autoload.php'; | |
$loader = new Twig_Loader_Filesystem(__DIR__); | |
$twig = new Twig_Environment($loader, array('debug' => true)); | |
echo $twig->render('template.twig', $_GET); |
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
{% macro breadcrumb(breadcrumb) -%} | |
<nav role="breadcrumb" class="breadcrumb"> | |
<ul> | |
{% for element in breadcrumb %} | |
<li><a href="{{ element.url }}">{{ element.title }}</a></li> | |
{% endfor %} | |
</ul> | |
</nav> | |
{%- endmacro %} |
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.twig' %} | |
{% use 'blocks.twig' %} | |
{% block footer %} | |
Specific Footer content | |
{% endblock %} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment