index.tpl 1.7 KB

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