Benutzer-Werkzeuge

Webseiten-Werkzeuge


design:twig:design-manual

Dies ist eine alte Version des Dokuments!


TWIG für Template-Designer

Dieses Dokument beschreibt die Syntax und Semantik der Template-Engine und ist sehr brauchbar als Referenz zur Erstellung von Twig Templates.

Synopsis

A template is simply a text file. It can generate any text-based format (HTML, XML, CSV, LaTeX, etc.). It doesn't have a specific extension, .html or .xml are just fine.

A template contains variables or expressions, which get replaced with values when the template is evaluated, and tags, which control the logic of the template.

Below is a minimal template that illustrates a few basics. We will cover further details later on:

<!DOCTYPE html>
<html>
    <head>
        <title>My Webpage</title>
    </head>
    <body>
        <ul id="navigation">
        {% for item in navigation %}
            <li><a href="{{ item.href }}">{{ item.caption }}</a></li>
        {% endfor %}
        </ul>
 
        <h1>My Webpage</h1>
        {{ a_variable }}
    </body>
</html>
design/twig/design-manual.1437264964.txt.gz · Zuletzt geändert: 19.07.2015 00:16 von Manuela v.d.Decken