Design:Layout.html
From Katapulta
Introducere
Fișierul layout.html este un fișier HTML/XHTML care conține și tag-uri Twig.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>{% block title %}My Shop{% endblock %}</title>
<link rel="stylesheet" type="text/css" href="{{'mystyle.css'|asset_url}}" />
<script type="text/javascript" src="{{'myscript.js'|asset_url}}"></script>
</head>
<body>
<div id="header">
{% block header %}
<h1 class="logo"><a href="{{ shop.url }}" title="{{ shop.name }}">{{ shop.name }}</a></h1>
{% endblock %}
</div>
<div id="main-menu">
{% block mainmenu %}
<ul>
{% for link in link_lists['main-menu'].links %}
<li><a href="{{ link.url }}" {% if link.url == active_url %} class="current" {% endif %}>{{ link.title|e }}</a></li>
{% endfor %}
</ul>
{% endblock %}
</div>
<div id="container">
<div id="sidebar">
{% block sidebar %}
{% include 'widgets/cartsummary.html' %}
{% include 'widgets/shopbyvendor.html' %}
{% include 'widgets/shopbytype.html' %}
{% endblock %}
</div>
<div id="content">
{% block content %}
<p>[...content here]</p>
{% endblock %}
</div>
</div>
<div id="footer">
{% block footermenu %}
<ul>
<li><a href="{{ pages['about'].url }}">About Us</a></li>
<li><a href="{{ pages['contact'].url }}">Contact Us</a></li>
<li><a href="{{ pages['terms'].url }}">Terms and conditions</a></li>
</ul>
{% endblock %}
{% block copyright %}
<p>© 2011. All Rights Reserved.</p>
{% endblock %}
</div>
</body>
</html>
Variabile
În template-ul layout.html ai acces la toate variabilele globale.