| 148 |
lars |
1 |
{config_load file="test.conf" section="setup"}
|
|
|
2 |
{include file="header.tpl" title=foo}
|
|
|
3 |
|
|
|
4 |
<PRE>
|
|
|
5 |
|
|
|
6 |
{* bold and title are read from the config file *}
|
|
|
7 |
{if #bold#}<b>{/if}
|
|
|
8 |
{* capitalize the first letters of each word of the title *}
|
|
|
9 |
Title: {#title#|capitalize}
|
|
|
10 |
{if #bold#}</b>{/if}
|
|
|
11 |
|
|
|
12 |
The current date and time is {$smarty.now|date_format:"%Y-%m-%d %H:%M:%S"}
|
|
|
13 |
|
|
|
14 |
The value of global assigned variable $SCRIPT_NAME is {$SCRIPT_NAME}
|
|
|
15 |
|
|
|
16 |
Example of accessing server environment variable SERVER_NAME: {$smarty.server.SERVER_NAME}
|
|
|
17 |
|
|
|
18 |
The value of {ldelim}$Name{rdelim} is <b>{$Name}</b>
|
|
|
19 |
|
|
|
20 |
variable modifier example of {ldelim}$Name|upper{rdelim}
|
|
|
21 |
|
|
|
22 |
<b>{$Name|upper}</b>
|
|
|
23 |
|
|
|
24 |
|
|
|
25 |
An example of a section loop:
|
|
|
26 |
|
|
|
27 |
{section name=outer
|
|
|
28 |
loop=$FirstName}
|
|
|
29 |
{if $smarty.section.outer.index is odd by 2}
|
|
|
30 |
{$smarty.section.outer.rownum} . {$FirstName[outer]} {$LastName[outer]}
|
|
|
31 |
{else}
|
|
|
32 |
{$smarty.section.outer.rownum} * {$FirstName[outer]} {$LastName[outer]}
|
|
|
33 |
{/if}
|
|
|
34 |
{sectionelse}
|
|
|
35 |
none
|
|
|
36 |
{/section}
|
|
|
37 |
|
|
|
38 |
An example of section looped key values:
|
|
|
39 |
|
|
|
40 |
{section name=sec1 loop=$contacts}
|
|
|
41 |
phone: {$contacts[sec1].phone}
|
|
|
42 |
<br>
|
|
|
43 |
|
|
|
44 |
fax: {$contacts[sec1].fax}
|
|
|
45 |
<br>
|
|
|
46 |
|
|
|
47 |
cell: {$contacts[sec1].cell}
|
|
|
48 |
<br>
|
|
|
49 |
{/section}
|
|
|
50 |
<p>
|
|
|
51 |
|
|
|
52 |
testing strip tags
|
|
|
53 |
{strip}
|
|
|
54 |
<table border=0>
|
|
|
55 |
<tr>
|
|
|
56 |
<td>
|
|
|
57 |
<A HREF="{$SCRIPT_NAME}">
|
|
|
58 |
<font color="red">This is a test </font>
|
|
|
59 |
</A>
|
|
|
60 |
</td>
|
|
|
61 |
</tr>
|
|
|
62 |
</table>
|
|
|
63 |
{/strip}
|
|
|
64 |
|
|
|
65 |
</PRE>
|
|
|
66 |
|
|
|
67 |
This is an example of the html_select_date function:
|
|
|
68 |
|
|
|
69 |
<form>
|
|
|
70 |
{html_select_date start_year=1998 end_year=2010}
|
|
|
71 |
</form>
|
|
|
72 |
|
|
|
73 |
This is an example of the html_select_time function:
|
|
|
74 |
|
|
|
75 |
<form>
|
|
|
76 |
{html_select_time use_24_hours=false}
|
|
|
77 |
</form>
|
|
|
78 |
|
|
|
79 |
This is an example of the html_options function:
|
|
|
80 |
|
|
|
81 |
<form>
|
|
|
82 |
<select name=states>
|
|
|
83 |
{html_options values=$option_values selected=$option_selected output=$option_output}
|
|
|
84 |
</select>
|
|
|
85 |
</form>
|
|
|
86 |
|
|
|
87 |
{include file="footer.tpl"}
|