Subversion-Projekte lars-tiefland.ci

Revision

Revision 46 | Details | Vergleich mit vorheriger | Letzte Änderung | Log anzeigen | RSS feed

Revision Autor Zeilennr. Zeile
46 lars 1
{include file="header.tpl" title="Example Smarty Page" name=$Name}
2
 
3
<h1>
4
{if $bold}<b>{/if}
5
{* capitalize the first letters of each word of the title *}
6
Title: {$title|capitalize}
7
{if $bold}</b>{/if}
8
</h1>
9
 
10
{if $error != ''}<p class="error">{$error}</p>{/if}
11
{if $message != ''}<p class="message">{$message}</p>{/if}
12
 
13
{ci_config name="base_url"}
14
<p>The configuration value of base_url is <em>{$base_url}</em></p>
15
 
16
<p>The current date and time is <em>{$smarty.now|date_format:"%Y-%m-%d %H:%M:%S"}</em></p>
17
 
18
<p>The value of global assigned variable $SCRIPT_NAME is <em>{$SCRIPT_NAME}</em></p>
19
 
20
<p>The value of server environment variable SERVER_NAME is <em>{$smarty.server.SERVER_NAME}</em></p>
21
 
22
<p>The value of your IP address is: <em>{$ip_address}</em></p>
23
 
24
<p>The value of {ldelim}$Name{rdelim} is <em>{$Name}</em></p>
25
 
26
<p>The value of {ldelim}$Name|upper{rdelim} is <em>{$Name|upper}</em></p>
27
 
28
<h2>An example of a section loop:</h2>
29
<ul>
30
{section name=outer loop=$FirstName}
31
{if $smarty.section.outer.index is odd by 2}
32
	<li>{$smarty.section.outer.rownum} . {$FirstName[outer]} {$LastName[outer]}</li>
33
{else}
34
	<li>{$smarty.section.outer.rownum} * {$FirstName[outer]} {$LastName[outer]}</li>
35
{/if}
36
{sectionelse}
37
	<li>none</li>
38
{/section}
39
</ul>
40
 
41
<h2>An example of section looped key values:</h2>
42
{section name=sec1 loop=$contacts}</li>
43
<ul>
44
	<li>phone: {$contacts[sec1].phone}</li>
45
	<li>fax: {$contacts[sec1].fax}</li>
46
	<li>cell: {$contacts[sec1].cell}</li>
47
</ul>
48
{/section}
49
 
50
<h2>An example testing strip tags:</h2>
51
{strip}
52
<table border=0>
53
	<tr>
54
		<td>
55
			<a HREF="{$SCRIPT_NAME}">
56
			<font color="red">This is a  test     </font>
57
			</a>
58
		</td>
59
	</tr>
60
</table>
61
{/strip}
62
 
63
 
64
<h2>An example of the html_select_date function:</h2>
65
 
66
<form>
67
{html_select_date start_year=1998 end_year=2010}
68
</form>
69
 
70
<h2>An example of the html_select_time function:</h2>
71
 
72
<form>
73
{html_select_time use_24_hours=false}
74
</form>
75
 
76
<h2>An example using form_validation:</h2>
77
 
78
{* the following line loads system/languages/$lang/label_lang.php *}
79
{ci_language file="label" lang="$lang"}
80
<form action="#" method="post">
81
<fieldset>
82
	<label for="username">{ci_language line="username"}:</label>
83
	<input type="text" name="username" id="username" value="{ci_form_validation field='username'}" /><br />
84
	{ci_form_validation field='username' error='true'}
85
 
86
	<label for="password">{ci_language line="password"}:</label>
87
{*
88
   Note: Can't use ci_form_validation to set the value for password
89
         because it is encrypted during validation.
90
*}
91
	<input type="password" name="password" id="password" value="" /><br />
92
	{ci_form_validation field='password' error='true'}
93
 
94
	<label for="passconf">{ci_language line="passconf"}:</label>
95
	<input type="password" name="passconf" id="passconf" value="" /><br />
96
	{ci_form_validation field='passconf' error='true'}
97
 
98
	<label for="email">{ci_language line="email"}:</label>
99
	<input type="text" name="email" id="email" value="{ci_form_validation field='email'}" /><br />
100
	{ci_form_validation field='email' error='true'}
101
 
102
	{ci_form_validation field='state' assign='selected_state'}
103
	<label for="state">{ci_language line="state"}:</label>
104
	<select name='state'>
105
	{html_options options=$state_options selected=$selected_state}
106
	</select><br />
107
	{ci_form_validation field='states' error='true'}
108
 
109
	<input type="submit" name="action" value="submit" />
110
</form>
111
 
112
{include file="footer.tpl"}