forked from KanbanSolutions/jquery-tmpl
-
Notifications
You must be signed in to change notification settings - Fork 0
/
3_if-else-tag.html
66 lines (55 loc) · 1.64 KB
/
3_if-else-tag.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
<!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">
<head>
<script src="http://code.jquery.com/jquery.js" type="text/javascript"></script>
<script src="../../../jquery.tmpl.js" type="text/javascript"></script>
<link href="../../resources/demos.css" rel="stylesheet" type="text/css" />
<link href="../../resources/movielist.css" rel="stylesheet" type="text/css" />
</head>
<body>
<a href="../../step-by-step.html">Home</a><br />
<a href="3_if-else-tag-source.html">Source</a>
<h3>Demo: Using {{if}} and {{else}} to render conditional sections.</h3>
<!--=================== Demo Section ===================-->
<script id="movieTemplate" type="text/x-jquery-tmpl">
<tr>
<td>${Title}</td>
<td>
{{if Languages}}
Alternative languages: <em>${Languages}</em>.
{{else Subtitles}}
Original language only... <br/>Subtitles in <em>${Subtitles}</em>.
{{else}}
Original version only, without subtitles.
{{/if}}
</td>
</tr>
</script>
<table><tbody class="header"><tr><th>Synopsis</th><th>Title</th></tr></tbody>
<tbody id="movieList"></tbody>
</table>
<script type="text/javascript">
var movies = [
{
Title: "Meet Joe Black",
Languages: "English and French",
Subtitles: "English"
},
{
Title: "Eyes Wide Shut",
Subtitles: "French and Spanish"
},
{
Title: "The Mighty"
},
{
Title: "City Hunter",
Languages: "Mandarin and Chinese"
}
];
$( "#movieTemplate" ).tmpl( movies )
.appendTo( "#movieList" );
</script>
<!--================ End of Demo Section ================-->
</body>
</html>