File: tests/3.html

Recommend this page to a friend!
  Classes of Aliaksandr Astashenkau  >  Templ  >  tests/3.html  >  Download  
File: tests/3.html
Role: Example script
Content type: text/plain
Description: If-statement, true-branch
Class: Templ
Processes templates embedded in the pages
Author: By
Last change:
Date: 8 years ago
Size: 1,108 bytes


Class file image Download
<html lang="en">
	<title>Templ test</title>
	<meta charset="UTF-8">
	<link rel="stylesheet" href="style.css">
	<script type="text/javascript" src="utils.js"></script>
	<script type="text/javascript" src="../templ.js"></script>

	If-statement, true-branch
	<a href="index.html" class="back">Back to tests</a>

<script type="html/template" id="tpl_example">
    <div class="user">
        <strong>User: {{ user.username }}</strong>
        {% if user.confirmed %}
            View your <a href="/account/records/{{ user.id }}">records</a>.
        {% else %}
        <p class="red">
            Please <a href="/account/confirm/{{ user.id }}">confirm</a> your account.
        {% endif %}

<pre id="template"></pre>

<pre id="data">
        user: {
            id: 21,
            username: 'Tomas',
            confirmed: true

<h3>Parsed result</h3>
<pre id="output"></pre>