Files
smarty/docs/en/designers/language-custom-functions/language-function-html-select-time.xml
2006-09-27 08:47:37 +00:00

226 lines
6.0 KiB
XML

<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision$ -->
<sect1 id="language.function.html.select.time">
<title>{html_select_time}</title>
<para>
<varname>{html_select_time}</varname> is a
<link linkend="language.custom.functions">custom function</link>
that creates time dropdowns for you.
It can display any or all of hour, minute, second and meridian.
</para>
<para>
The <parameter>time</parameter> attribute can have different formats.
It can be a unique timestamp, a string of the format
<literal>YYYYMMDDHHMMSS</literal> or a string that is parseable by PHP's
<ulink url="&url.php-manual;strtotime"><varname>strtotime()</varname></ulink>.
</para>
<informaltable frame="all">
<tgroup cols="5">
<colspec colname="param" align="center" />
<colspec colname="type" align="center" />
<colspec colname="required" align="center" />
<colspec colname="default" align="center" />
<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>
<row>
<entry>field_array</entry>
<entry>string</entry>
<entry>No</entry>
<entry>n/a</entry>
<entry>Outputs values to array of this name</entry>
</row>
<row>
<entry>all_extra</entry>
<entry>string</entry>
<entry>No</entry>
<entry>null</entry>
<entry>Adds extra attributes to select/input tags if given</entry>
</row>
<row>
<entry>hour_extra</entry>
<entry>string</entry>
<entry>No</entry>
<entry>null</entry>
<entry>Adds extra attributes to select/input tags if
given</entry>
</row>
<row>
<entry>minute_extra</entry>
<entry>string</entry>
<entry>No</entry>
<entry>null</entry>
<entry>Adds extra attributes to select/input tags if
given</entry>
</row>
<row>
<entry>second_extra</entry>
<entry>string</entry>
<entry>No</entry>
<entry>null</entry>
<entry>Adds extra attributes to select/input tags if
given</entry>
</row>
<row>
<entry>meridian_extra</entry>
<entry>string</entry>
<entry>No</entry>
<entry>null</entry>
<entry>Adds extra attributes to select/input tags if
given</entry>
</row>
</tbody>
</tgroup>
</informaltable>
<example>
<title>{html_select_time}</title>
<programlisting>
<![CDATA[
{html_select_time use_24_hours=true}
]]>
</programlisting>
<para>
At 9:20 and 23 seconds in the morning the template above would output:
</para>
<screen>
<![CDATA[
<select name="Time_Hour">
<option value="00">00</option>
<option value="01">01</option>
... snipped ....
<option value="08">08</option>
<option value="09" selected>09</option>
<option value="10">10</option>
... snipped ....
<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>
... snipped ....
<option value="19">19</option>
<option value="20" selected>20</option>
<option value="21">21</option>
... snipped ....
<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>
... snipped ....
<option value="22">22</option>
<option value="23" selected>23</option>
<option value="24">24</option>
... snipped ....
<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>
]]>
</screen>
</example>
<para>
See also
<link linkend="language.variables.smarty.now"><parameter>$smarty.now</parameter></link>,
<link linkend="language.function.html.select.date"><varname>{html_select_date}</varname></link>
and the <link linkend="tips.dates">date tips page</link>.
</para>
</sect1>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
indent-tabs-mode:nil
sgml-parent-document:nil
sgml-default-dtd-file:"../../../../manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
vim600: syn=xml fen fdm=syntax fdl=2 si
vim: et tw=78 syn=sgml
vi: ts=1 sw=1
-->