source: branches/rel/data/module/Smarty/demo/templates/index.tpl @ 12157

Revision 12157, 1.7 KB checked in by uehara, 17 years ago (diff)
Line 
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 *}
9Title: {#title#|capitalize}
10{if #bold#}</b>{/if}
11
12The current date and time is {$smarty.now|date_format:"%Y-%m-%d %H:%M:%S"}
13
14The value of global assigned variable $SCRIPT_NAME is {$SCRIPT_NAME}
15
16Example of accessing server environment variable SERVER_NAME: {$smarty.server.SERVER_NAME}
17
18The value of {ldelim}$Name{rdelim} is <b>{$Name}</b>
19
20variable modifier example of {ldelim}$Name|upper{rdelim}
21
22<b>{$Name|upper}</b>
23
24
25An example of a section loop:
26
27{section name=outer loop=$FirstName}
28{if $smarty.section.outer.index is odd by 2}
29    {$smarty.section.outer.rownum} . {$FirstName[outer]} {$LastName[outer]}
30{else}
31    {$smarty.section.outer.rownum} * {$FirstName[outer]} {$LastName[outer]}
32{/if}
33{sectionelse}
34    none
35{/section}
36
37An example of section looped key values:
38
39{section name=sec1 loop=$contacts}
40    phone: {$contacts[sec1].phone}<br>
41    fax: {$contacts[sec1].fax}<br>
42    cell: {$contacts[sec1].cell}<br>
43{/section}
44<p>
45
46testing strip tags
47{strip}
48<table border=0>
49    <tr>
50        <td>
51            <A HREF="{$SCRIPT_NAME}">
52            <font color="red">This is a  test     </font>
53            </A>
54        </td>
55    </tr>
56</table>
57{/strip}
58
59</PRE>
60
61This is an example of the html_select_date function:
62
63<form>
64{html_select_date start_year=1998 end_year=2010}
65</form>
66
67This is an example of the html_select_time function:
68
69<form>
70{html_select_time use_24_hours=false}
71</form>
72
73This is an example of the html_options function:
74
75<form>
76<select name=states>
77{html_options values=$option_values selected=$option_selected output=$option_output}
78</select>
79</form>
80
81{include file="footer.tpl"}
Note: See TracBrowser for help on using the repository browser.