1 | <?xml version="1.0" encoding="UTF-8"?>
|
---|
2 | <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
---|
3 | <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
---|
4 | <head>
|
---|
5 | <title>Test</title>
|
---|
6 | <style type="text/css">
|
---|
7 | table {width:20em;}
|
---|
8 | </style>
|
---|
9 | </head>
|
---|
10 | <body>
|
---|
11 |
|
---|
12 | <p>Pass in a list called 'list' to this template to test behaviour...</p>
|
---|
13 |
|
---|
14 |
|
---|
15 | <table border="1">
|
---|
16 | <caption>1.</caption>
|
---|
17 | {% for item in list %}
|
---|
18 | <tr>
|
---|
19 | <td>{{ item }}</td>
|
---|
20 | <td>{% cycle 'row1' 'row2' 'row3' %}</td>
|
---|
21 | </tr>
|
---|
22 | {% endfor %}
|
---|
23 | </table>
|
---|
24 |
|
---|
25 | <hr/>
|
---|
26 |
|
---|
27 | <table border="1">
|
---|
28 | <caption>2. 'as' form, no 'silent' flag</caption>
|
---|
29 | {% for item in list %}
|
---|
30 | <tr>
|
---|
31 | <td>{{ item }}</td>
|
---|
32 | <td>{% cycle 'row1' 'row2' 'row3' as rownum %}</td>
|
---|
33 | </tr>
|
---|
34 | {% endfor %}
|
---|
35 | </table>
|
---|
36 |
|
---|
37 | <p>{% cycle rownum %}<br/>
|
---|
38 | {% cycle rownum %}<br/>
|
---|
39 | {% cycle rownum %}</p>
|
---|
40 |
|
---|
41 | <hr/>
|
---|
42 |
|
---|
43 | <table border="1">
|
---|
44 | <caption>3. 'as' form, 'silent' False</caption>
|
---|
45 | {% for item in list %}
|
---|
46 | <tr>
|
---|
47 | <td>{{ item }}</td>
|
---|
48 | <td>{% cycle 'row1' 'row2' 'row3' as rownum 0 %}</td>
|
---|
49 | <td>{{ rownum }}</td>
|
---|
50 | </tr>
|
---|
51 | {% endfor %}
|
---|
52 | </table>
|
---|
53 |
|
---|
54 | <p>{% cycle rownum %}<br/>
|
---|
55 | {% cycle rownum %}<br/>
|
---|
56 | {% cycle rownum %}</p>
|
---|
57 |
|
---|
58 | <hr/>
|
---|
59 |
|
---|
60 | <table border="1">
|
---|
61 | <caption>4. 'as' form, 'silent' True</caption>
|
---|
62 | {% for item in list %}
|
---|
63 | <tr>
|
---|
64 | <td>{{ item }}</td>
|
---|
65 | <td>{% cycle 'row1' 'row2' 'row3' as rownum 1 %}</td>
|
---|
66 | <td>{{ rownum }}</td>
|
---|
67 | </tr>
|
---|
68 | {% endfor %}
|
---|
69 | </table>
|
---|
70 |
|
---|
71 | <p>{% cycle rownum %}<br/>
|
---|
72 | {% cycle rownum %}<br/>
|
---|
73 | {% cycle rownum %}</p>
|
---|
74 |
|
---|
75 | <hr/>
|
---|
76 |
|
---|
77 | <table border="1">
|
---|
78 | <caption>2. (again) still works?</caption>
|
---|
79 | {% for item in list %}
|
---|
80 | <tr>
|
---|
81 | <td>{{ item }}</td>
|
---|
82 | <td>{% cycle 'row1' 'row2' 'row3' as rownum %}</td>
|
---|
83 | </tr>
|
---|
84 | {% endfor %}
|
---|
85 | </table>
|
---|
86 |
|
---|
87 | <p>{% cycle rownum %}<br/>
|
---|
88 | {% cycle rownum %}<br/>
|
---|
89 | {% cycle rownum %}</p>
|
---|
90 |
|
---|
91 | <hr/>
|
---|
92 |
|
---|
93 | </body>
|
---|
94 | </html>
|
---|