mirror of
https://github.com/smarty-php/smarty.git
synced 2025-08-05 19:04:27 +02:00
update docs, example template
This commit is contained in:
@@ -54,6 +54,12 @@ This is an example of the html_select_date function:
|
||||
{html_select_date start_year=1998 end_year=2010}
|
||||
</form>
|
||||
|
||||
This is an example of the html_select_time function:
|
||||
|
||||
<form>
|
||||
{html_select_time use_24_hours=false}
|
||||
</form>
|
||||
|
||||
This is an example of the html_options function:
|
||||
|
||||
<form>
|
||||
|
414
docs.sgml
414
docs.sgml
@@ -1155,6 +1155,48 @@ Intro = """This is a value that spans more
|
||||
</para>
|
||||
<sect2 id="builtin.functions.configload">
|
||||
<title>config_load</title>
|
||||
<informaltable frame=all>
|
||||
<tgroup cols=3>
|
||||
<colspec colname=param>
|
||||
<colspec colname=type>
|
||||
<colspec colname=required>
|
||||
<colspec colname=default>
|
||||
<colspec colname=desc>
|
||||
<thead>
|
||||
<row>
|
||||
<entry>Attribute Name</entry>
|
||||
<entry>Type</entry>
|
||||
<entry>Required</entry>
|
||||
<entry>Default</entry>
|
||||
<entry>Description</entry>
|
||||
</row>
|
||||
</thead>
|
||||
<tbody>
|
||||
<row>
|
||||
<entry>file</entry>
|
||||
<entry>string</entry>
|
||||
<entry>Yes</entry>
|
||||
<entry><emphasis>n/a</emphasis></entry>
|
||||
<entry>The name of the config file to include</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>section</entry>
|
||||
<entry>string</entry>
|
||||
<entry>No</entry>
|
||||
<entry><emphasis>n/a</emphasis></entry>
|
||||
<entry>The name of the section to load</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>global</entry>
|
||||
<entry>boolean</entry>
|
||||
<entry>No</entry>
|
||||
<entry><emphasis>No</emphasis></entry>
|
||||
<entry>Whether or not variables are global (visible to
|
||||
parent templates)</entry>
|
||||
</row>
|
||||
</tbody>
|
||||
</tgroup>
|
||||
</informaltable>
|
||||
<para>
|
||||
This function is used for loading in variables from a
|
||||
configuration file into the template. You must have the Config_file.class.php
|
||||
@@ -1163,6 +1205,7 @@ Intro = """This is a value that spans more
|
||||
</para>
|
||||
<example>
|
||||
<title>function config_load</title>
|
||||
|
||||
<programlisting>
|
||||
|
||||
{config_load file="colors.conf"}
|
||||
@@ -1215,6 +1258,40 @@ Intro = """This is a value that spans more
|
||||
</sect2>
|
||||
<sect2>
|
||||
<title>include</title>
|
||||
<informaltable frame=all>
|
||||
<tgroup cols=3>
|
||||
<colspec colname=param>
|
||||
<colspec colname=type>
|
||||
<colspec colname=required>
|
||||
<colspec colname=default>
|
||||
<colspec colname=desc>
|
||||
<thead>
|
||||
<row>
|
||||
<entry>Attribute Name</entry>
|
||||
<entry>Type</entry>
|
||||
<entry>Required</entry>
|
||||
<entry>Default</entry>
|
||||
<entry>Description</entry>
|
||||
</row>
|
||||
</thead>
|
||||
<tbody>
|
||||
<row>
|
||||
<entry>file</entry>
|
||||
<entry>string</entry>
|
||||
<entry>Yes</entry>
|
||||
<entry><emphasis>n/a</emphasis></entry>
|
||||
<entry>The name of the template file to include</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>[var ...]</entry>
|
||||
<entry>[var type]</entry>
|
||||
<entry>No</entry>
|
||||
<entry><emphasis>n/a</emphasis></entry>
|
||||
<entry>variable to pass local to template</entry>
|
||||
</row>
|
||||
</tbody>
|
||||
</tgroup>
|
||||
</informaltable>
|
||||
<para>
|
||||
Include tags are used for including other templates in the current
|
||||
template. Any variables available in the current template are also
|
||||
@@ -1255,6 +1332,40 @@ Intro = """This is a value that spans more
|
||||
</sect2>
|
||||
<sect2 id="function.insert">
|
||||
<title>insert</title>
|
||||
<informaltable frame=all>
|
||||
<tgroup cols=3>
|
||||
<colspec colname=param>
|
||||
<colspec colname=type>
|
||||
<colspec colname=required>
|
||||
<colspec colname=default>
|
||||
<colspec colname=desc>
|
||||
<thead>
|
||||
<row>
|
||||
<entry>Attribute Name</entry>
|
||||
<entry>Type</entry>
|
||||
<entry>Required</entry>
|
||||
<entry>Default</entry>
|
||||
<entry>Description</entry>
|
||||
</row>
|
||||
</thead>
|
||||
<tbody>
|
||||
<row>
|
||||
<entry>name</entry>
|
||||
<entry>string</entry>
|
||||
<entry>Yes</entry>
|
||||
<entry><emphasis>n/a</emphasis></entry>
|
||||
<entry>The name of the insert function (insert_name)</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>[var ...]</entry>
|
||||
<entry>[var type]</entry>
|
||||
<entry>No</entry>
|
||||
<entry><emphasis>n/a</emphasis></entry>
|
||||
<entry>variable to pass to insert function</entry>
|
||||
</row>
|
||||
</tbody>
|
||||
</tgroup>
|
||||
</informaltable>
|
||||
<para>
|
||||
The insert tag in Smarty serves a special purpose. You may
|
||||
run into the situation where it is impossible to pass data to a template
|
||||
@@ -1442,6 +1553,48 @@ OUTPUT:
|
||||
</sect2>
|
||||
<sect2 id="builtin.functions.section">
|
||||
<title>section,sectionelse</title>
|
||||
<informaltable frame=all>
|
||||
<tgroup cols=3>
|
||||
<colspec colname=param>
|
||||
<colspec colname=type>
|
||||
<colspec colname=required>
|
||||
<colspec colname=default>
|
||||
<colspec colname=desc>
|
||||
<thead>
|
||||
<row>
|
||||
<entry>Attribute Name</entry>
|
||||
<entry>Type</entry>
|
||||
<entry>Required</entry>
|
||||
<entry>Default</entry>
|
||||
<entry>Description</entry>
|
||||
</row>
|
||||
</thead>
|
||||
<tbody>
|
||||
<row>
|
||||
<entry>name</entry>
|
||||
<entry>string</entry>
|
||||
<entry>Yes</entry>
|
||||
<entry><emphasis>n/a</emphasis></entry>
|
||||
<entry>The name of the section</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>loop</entry>
|
||||
<entry>[$variable_name]</entry>
|
||||
<entry>Yes</entry>
|
||||
<entry><emphasis>n/a</emphasis></entry>
|
||||
<entry>The name of the variable to determine # of loop
|
||||
iterations</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>show</entry>
|
||||
<entry>boolean</entry>
|
||||
<entry>No</entry>
|
||||
<entry><emphasis>true</emphasis></entry>
|
||||
<entry>determines whether or not to show this section</entry>
|
||||
</row>
|
||||
</tbody>
|
||||
</tgroup>
|
||||
</informaltable>
|
||||
<para>
|
||||
Template sections are used for looping over arrays of data. All
|
||||
<emphasis>section</emphasis> tags must be paired with
|
||||
@@ -1836,7 +1989,7 @@ There were 3 customers shown above.
|
||||
present, that will be alternately displayed.
|
||||
</para>
|
||||
<example>
|
||||
<title>section property rownum</title>
|
||||
<title>section attribute show</title>
|
||||
<programlisting>
|
||||
{* $show_customer_info may have been passed from the PHP
|
||||
application, to regulate whether or not this section shows *}
|
||||
@@ -2267,6 +2420,263 @@ OUTPUT:
|
||||
<option value="2001">2001</option>
|
||||
</select>
|
||||
|
||||
</programlisting>
|
||||
</example>
|
||||
</sect2>
|
||||
<sect2>
|
||||
<title>html_select_time</title>
|
||||
<informaltable frame=all>
|
||||
<tgroup cols=3>
|
||||
<colspec colname=param>
|
||||
<colspec colname=type>
|
||||
<colspec colname=required>
|
||||
<colspec colname=default>
|
||||
<colspec colname=desc>
|
||||
<thead>
|
||||
<row>
|
||||
<entry>Attribute Name</entry>
|
||||
<entry>Type</entry>
|
||||
<entry>Required</entry>
|
||||
<entry>Default</entry>
|
||||
<entry>Description</entry>
|
||||
</row>
|
||||
</thead>
|
||||
<tbody>
|
||||
<row>
|
||||
<entry>prefix</entry>
|
||||
<entry>string</entry>
|
||||
<entry>No</entry>
|
||||
<entry>Time_</entry>
|
||||
<entry>what to prefix the var name with</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>time</entry>
|
||||
<entry>timestamp</entry>
|
||||
<entry>No</entry>
|
||||
<entry>current time</entry>
|
||||
<entry>what date/time to use</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>display_hours</entry>
|
||||
<entry>boolean</entry>
|
||||
<entry>No</entry>
|
||||
<entry>true</entry>
|
||||
<entry>whether or not to display hours</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>display_minutes</entry>
|
||||
<entry>boolean</entry>
|
||||
<entry>No</entry>
|
||||
<entry>true</entry>
|
||||
<entry>whether or not to display minutes</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>display_seconds</entry>
|
||||
<entry>boolean</entry>
|
||||
<entry>No</entry>
|
||||
<entry>true</entry>
|
||||
<entry>whether or not to display seconds</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>display_meridian</entry>
|
||||
<entry>boolean</entry>
|
||||
<entry>No</entry>
|
||||
<entry>true</entry>
|
||||
<entry>whether or not to display meridian (am/pm)</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>use_24_hours</entry>
|
||||
<entry>boolean</entry>
|
||||
<entry>No</entry>
|
||||
<entry>true</entry>
|
||||
<entry>whether or not to use 24 hour clock</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>minute_interval</entry>
|
||||
<entry>integer</entry>
|
||||
<entry>No</entry>
|
||||
<entry>1</entry>
|
||||
<entry>number interval in minute dropdown</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>second_interval</entry>
|
||||
<entry>integer</entry>
|
||||
<entry>No</entry>
|
||||
<entry>1</entry>
|
||||
<entry>number interval in second dropdown</entry>
|
||||
</row>
|
||||
</tbody>
|
||||
</tgroup>
|
||||
</informaltable>
|
||||
<para>
|
||||
html_select_time is a custom function that creates time dropdowns
|
||||
for you. It can display any or all of hour, minute, second and
|
||||
meridian.
|
||||
</para>
|
||||
<example>
|
||||
<title>html_select_time</title>
|
||||
<programlisting>
|
||||
|
||||
{html_select_time use_24_hours=false}
|
||||
|
||||
|
||||
OUTPUT:
|
||||
|
||||
<select name="Time_Hour">
|
||||
<option value="00">00</option>
|
||||
<option value="01">01</option>
|
||||
<option value="02">02</option>
|
||||
<option value="03">03</option>
|
||||
<option value="04">04</option>
|
||||
<option value="05">05</option>
|
||||
<option value="06">06</option>
|
||||
<option value="07">07</option>
|
||||
<option value="08">08</option>
|
||||
<option value="09" selected>09</option>
|
||||
<option value="10">10</option>
|
||||
<option value="11">11</option>
|
||||
<option value="12">12</option>
|
||||
<option value="13">13</option>
|
||||
<option value="14">14</option>
|
||||
<option value="15">15</option>
|
||||
<option value="16">16</option>
|
||||
<option value="17">17</option>
|
||||
<option value="18">18</option>
|
||||
<option value="19">19</option>
|
||||
<option value="20">20</option>
|
||||
<option value="21">21</option>
|
||||
<option value="22">22</option>
|
||||
<option value="23">23</option>
|
||||
</select>
|
||||
<select name="Time_Minute">
|
||||
<option value="00">00</option>
|
||||
<option value="01">01</option>
|
||||
<option value="02">02</option>
|
||||
<option value="03">03</option>
|
||||
<option value="04">04</option>
|
||||
<option value="05">05</option>
|
||||
<option value="06">06</option>
|
||||
<option value="07">07</option>
|
||||
<option value="08">08</option>
|
||||
<option value="09">09</option>
|
||||
<option value="10">10</option>
|
||||
<option value="11">11</option>
|
||||
<option value="12">12</option>
|
||||
<option value="13">13</option>
|
||||
<option value="14">14</option>
|
||||
<option value="15">15</option>
|
||||
<option value="16">16</option>
|
||||
<option value="17">17</option>
|
||||
<option value="18">18</option>
|
||||
<option value="19">19</option>
|
||||
<option value="20" selected>20</option>
|
||||
<option value="21">21</option>
|
||||
<option value="22">22</option>
|
||||
<option value="23">23</option>
|
||||
<option value="24">24</option>
|
||||
<option value="25">25</option>
|
||||
<option value="26">26</option>
|
||||
<option value="27">27</option>
|
||||
<option value="28">28</option>
|
||||
<option value="29">29</option>
|
||||
<option value="30">30</option>
|
||||
<option value="31">31</option>
|
||||
<option value="32">32</option>
|
||||
<option value="33">33</option>
|
||||
<option value="34">34</option>
|
||||
<option value="35">35</option>
|
||||
<option value="36">36</option>
|
||||
<option value="37">37</option>
|
||||
<option value="38">38</option>
|
||||
<option value="39">39</option>
|
||||
<option value="40">40</option>
|
||||
<option value="41">41</option>
|
||||
<option value="42">42</option>
|
||||
<option value="43">43</option>
|
||||
<option value="44">44</option>
|
||||
<option value="45">45</option>
|
||||
<option value="46">46</option>
|
||||
<option value="47">47</option>
|
||||
<option value="48">48</option>
|
||||
<option value="49">49</option>
|
||||
<option value="50">50</option>
|
||||
<option value="51">51</option>
|
||||
<option value="52">52</option>
|
||||
<option value="53">53</option>
|
||||
<option value="54">54</option>
|
||||
<option value="55">55</option>
|
||||
<option value="56">56</option>
|
||||
<option value="57">57</option>
|
||||
<option value="58">58</option>
|
||||
<option value="59">59</option>
|
||||
</select>
|
||||
<select name="Time_Second">
|
||||
<option value="00">00</option>
|
||||
<option value="01">01</option>
|
||||
<option value="02">02</option>
|
||||
<option value="03">03</option>
|
||||
<option value="04">04</option>
|
||||
<option value="05">05</option>
|
||||
<option value="06">06</option>
|
||||
<option value="07">07</option>
|
||||
<option value="08">08</option>
|
||||
<option value="09">09</option>
|
||||
<option value="10">10</option>
|
||||
<option value="11">11</option>
|
||||
<option value="12">12</option>
|
||||
<option value="13">13</option>
|
||||
<option value="14">14</option>
|
||||
<option value="15">15</option>
|
||||
<option value="16">16</option>
|
||||
<option value="17">17</option>
|
||||
<option value="18">18</option>
|
||||
<option value="19">19</option>
|
||||
<option value="20">20</option>
|
||||
<option value="21">21</option>
|
||||
<option value="22">22</option>
|
||||
<option value="23" selected>23</option>
|
||||
<option value="24">24</option>
|
||||
<option value="25">25</option>
|
||||
<option value="26">26</option>
|
||||
<option value="27">27</option>
|
||||
<option value="28">28</option>
|
||||
<option value="29">29</option>
|
||||
<option value="30">30</option>
|
||||
<option value="31">31</option>
|
||||
<option value="32">32</option>
|
||||
<option value="33">33</option>
|
||||
<option value="34">34</option>
|
||||
<option value="35">35</option>
|
||||
<option value="36">36</option>
|
||||
<option value="37">37</option>
|
||||
<option value="38">38</option>
|
||||
<option value="39">39</option>
|
||||
<option value="40">40</option>
|
||||
<option value="41">41</option>
|
||||
<option value="42">42</option>
|
||||
<option value="43">43</option>
|
||||
<option value="44">44</option>
|
||||
<option value="45">45</option>
|
||||
<option value="46">46</option>
|
||||
<option value="47">47</option>
|
||||
<option value="48">48</option>
|
||||
<option value="49">49</option>
|
||||
<option value="50">50</option>
|
||||
<option value="51">51</option>
|
||||
<option value="52">52</option>
|
||||
<option value="53">53</option>
|
||||
<option value="54">54</option>
|
||||
<option value="55">55</option>
|
||||
<option value="56">56</option>
|
||||
<option value="57">57</option>
|
||||
<option value="58">58</option>
|
||||
<option value="59">59</option>
|
||||
</select>
|
||||
<select name="Time_Meridian">
|
||||
<option value="am" selected>AM</option>
|
||||
<option value="pm">PM</option>
|
||||
</select>
|
||||
|
||||
</programlisting>
|
||||
</example>
|
||||
</sect2>
|
||||
@@ -2311,7 +2721,7 @@ OUTPUT:
|
||||
<entry>equation variable value</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>...[var]</entry>
|
||||
<entry>[var ...]</entry>
|
||||
<entry>numeric</entry>
|
||||
<entry>Yes</entry>
|
||||
<entry><emphasis>n/a</emphasis></entry>
|
||||
|
@@ -54,6 +54,12 @@ This is an example of the html_select_date function:
|
||||
{html_select_date start_year=1998 end_year=2010}
|
||||
</form>
|
||||
|
||||
This is an example of the html_select_time function:
|
||||
|
||||
<form>
|
||||
{html_select_time use_24_hours=false}
|
||||
</form>
|
||||
|
||||
This is an example of the html_options function:
|
||||
|
||||
<form>
|
||||
|
Reference in New Issue
Block a user