| 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 | Tooltip example: Move your mouse over the <A HREF="" {popup sticky=true caption="Smarty pop-up text" delay=400 text="This is an example of a tooltip. Tooltips are handy for context sensitive information, and extremely easy to add to your templates with Smarty and the integration of <a href='http://www.bosrup.com/web/overlib/'>overLIB</a> by Erik Bosrup"} onclick="return false;">Help</A> link to see an example of a tooltip using Smarty's popup function. |
| 15 | |
| 16 | The value of global assigned variable $SCRIPT_NAME is {$SCRIPT_NAME} |
| 17 | |
| 18 | Example of accessing server environment variable SERVER_NAME: {$smarty.server.SERVER_NAME} |
| 19 | |
| 20 | The value of {ldelim}$Name{rdelim} is <b>{$Name}</b> |
| 21 | |
| 22 | variable modifier example of {ldelim}$Name|upper{rdelim} |
| 23 | |
| 24 | <b>{$Name|upper}</b> |
| 25 | |
| 26 | |
| 27 | An example of a section loop: |
| 28 | |
| 29 | {section name=outer loop=$FirstName} |
| 30 | {if %outer.index% is odd by 2} |
| 31 | {%outer.rownum%} . {$FirstName[outer]} {$LastName[outer]} |
| 32 | {else} |
| 33 | {%outer.rownum%} * {$FirstName[outer]} {$LastName[outer]} |
| 34 | {/if} |
| 35 | {sectionelse} |
| 36 | none |
| 37 | {/section} |
| 38 | |
| 39 | An example of section looped key values: |
| 40 | |
| 41 | {section name=sec1 loop=$contacts} |
| 42 | phone: {$contacts[sec1].phone}<br> |
| 43 | fax: {$contacts[sec1].fax}<br> |
| 44 | cell: {$contacts[sec1].cell}<br> |
| 45 | {/section} |
| 46 | <p> |
| 47 | |
| 48 | testing strip tags |
| 49 | {strip} |
| 50 | <table border=0> |
| 51 | <tr> |
| 52 | <td> |
| 53 | <A HREF="{$SCRIPT_NAME}"> |
| 54 | <font color="red">This is a test </font> |
| 55 | </A> |
| 56 | </td> |
| 57 | </tr> |
| 58 | </table> |
| 59 | {/strip} |
| 60 | |
| 61 | </PRE> |
| 62 | |
| 63 | This is an example of the html_select_date function: |
| 64 | |
| 65 | <form> |
| 66 | {html_select_date start_year=1998 end_year=2010} |
| 67 | </form> |
| 68 | |
| 69 | This is an example of the html_select_time function: |
| 70 | |
| 71 | <form> |
| 72 | {html_select_time use_24_hours=false} |
| 73 | </form> |
| 74 | |
| 75 | This is an example of the html_options function: |
| 76 | |
| 77 | <form> |
| 78 | <select name=states> |
| 79 | {html_options values=$option_values selected=$option_selected output=$option_output} |
| 80 | </select> |
| 81 | </form> |
| 82 | |
| 83 | {include file="footer.tpl"} |