File: test.html

package info (click to toggle)
raintpl 3.1.1-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 888 kB
  • sloc: php: 1,555; javascript: 683; makefile: 8
file content (91 lines) | stat: -rw-r--r-- 1,929 bytes parent folder | download | duplicates (3)
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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
<!DOCTYPE html>
<html lang="en">
<head>
	<title>{$title}</title>
	<link rel="stylesheet" href="style.css" type="text/css" />
</head>
<body>

    <!-- if remove_comments is enabled this will disappear -->

    {* This is a comment *}

	<h1>Test Rain Tpl {$version}</h1>
	<hr>

	<h2>Variables</h2>
	Variable: {$variable} <br><br>
	Init Variable {$v = 10} <br><br>
	Show Variable {$v} <br><br>
	Modifier {$variable|strlen} <br><br>
	Cascade Modifier {$variable|substr:2,5|strlen} <br><br>
	Scoping (object) {$user->name} <br><br>
	Scoping (array) {$week.0} <br><br>
	Variable as key {$week[$numbers.0]} <br><br>
	Var test {$variable} <br><br>

    <h2>Ternary Operator</h2>
    The title is: {isset($title)?"$title":'default title'}


	<h2>Loop</h2>
	Simple Loop
	<ul>
		{loop="$week"}
		<li>
			{$key} {$value}
		</li>
		{/loop}
	</ul><br><br>

	Modifier on Loop
	<ul>
		{loop="$week|array_reverse" as $i}
		<li>{$i}</li>
		{/loop}
	</ul><br><br>

	Simple Nested Loop
	<ul>
		{loop="$table"}
		<li>
			{loop="$value"}
			{$value},
			{/loop}
		</li>
		{/loop}
	</ul><br><br>

	Loop on created array
	<ul>
		{loop="range(5,10)" as $i}
		<li>{$i}</li>
		{/loop}
	</ul><br><br>

	<h2>If</h2>
	True condition: {if="true"}This is true{/if} <br><br>
	Modifier inside if: {if="$variable|is_string"}True{/if} <br><br>


	<h2>Function test</h2>
	Simple function: {function="time"} <br><br>
	Function with parameters: {function="date('d-m-Y')"} <br><br>
	Static method: {function="Test::method('123test')"} <br><br>

	<h2>Escape Text</h2>
	Malicious content: {$bad_text} <br><br>

	<h2>Custom tag</h2>
	{@message to translate@} <br><br>

	<h2>Custom tag 2</h2>
	{%message to translate|english%} <br><br>
        
        <h2>Escape variable</h2>
        {$bad_variable}
        {autoescape="off"}{$safe_variable}{/autoescape}
        

</body>
</html>