Design:Layout.html
From Katapulta
(Difference between revisions)
m |
m |
||
Line 1: | Line 1: | ||
Fișierul '''layout.html''' este un fișier HTML/XHTML care conține și tag-uri [[Design:Twig|Twig]]. | Fișierul '''layout.html''' este un fișier HTML/XHTML care conține și tag-uri [[Design:Twig|Twig]]. | ||
+ | |||
+ | Un exemplu de fișier de tip ''layout'' poate arăta astfel: | ||
<html><div class="highlight"> | <html><div class="highlight"> |
Revision as of 08:42, 29 April 2011
Fișierul layout.html este un fișier HTML/XHTML care conține și tag-uri Twig.
Un exemplu de fișier de tip layout poate arăta astfel:
<!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>
block) care vor fi suprascrise de celelalte template-uri (product, collection, post, etc). De exemplu, unul din blocurile importante care trebuie să se regăsească în orice temă Katapulta este cel denumit în exemplul de mai sus
content(numele nu este important) care va si suprascris în toate template-urile cu conținutul specific fiecărui template.
Variabile
În template-ul layout.html ai acces la toate variabilele globale.