Skip to content

Instantly share code, notes, and snippets.

@coreymcmahon
Created May 2, 2012 12:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save coreymcmahon/2576174 to your computer and use it in GitHub Desktop.
Save coreymcmahon/2576174 to your computer and use it in GitHub Desktop.
Bigger example of a Twig template - http://www.symfonycentral.com
<!DOCTYPE html>
<html>
<head>
{# title has been passed from the controller as an argument to 'render' #}
<title>{{ title|raw }}</title>
</head>
<body>
<nav>
<ul id="navigation">
{# Here navigation is an array of arrays... #}
{% for item in navigation %}
<li><a href="{{ item.href }}">{{ item.title }}</a></li>
{% endfor %}
</ul>
</nav>
<header>
{# Use a function to generate some output #}
<img src="{{ asset('images/logo.png') }}" alt="Symfony!" />
</header>
<article>
{# Access some variables Twig automatically sets-up for us #}
{% if app.session.hasFlash('notice') %}
<div class="flash-notice">
{{ app.session.flash('notice') }}
</div>
{% endif %}
<!-- and so on and so on... -->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment