Login   Register  
Icontem

File: tests/8.html

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of Aliaksandr Astashenkau  >  Templ  >  tests/8.html  >  Download  
File: tests/8.html
Role: Example script
Content type: text/plain
Description: For-loop inside if-block
Class: Templ
Processes templates embedded in the pages
Author: By
Last change:
Date: 2011-07-01 04:57
Size: 846 bytes
 

Contents

Class file image Download
<!DOCTYPE HTML>
<html lang="en">
<head>
	<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>
</head>
<body>

<h2>
	For-loop inside if-block
	<a href="index.html" class="back">Back to tests</a>
</h2>

<script type="html/template" id="tpl_example">
    {% if mode == 'check' %}
        {% for k, r in records %}
            {{ k }}: {{ r }}
        {% endfor %}
    {% endif %}
</script>

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

<h3>Data</h3>
<pre id="data">
    {
        mode: 'check',
        records: {
            id: 5,
            time: '2011-03-24'
        }
    }
</pre>

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

</body>
</html>