Files
smarty/docs/en/designers/language-custom-functions/language-function-html-select-date.xml

348 lines
14 KiB
XML
Raw Normal View History

2004-04-13 08:46:28 +00:00
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision$ -->
<sect1 id="language.function.html.select.date">
<title>html_select_date</title>
<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>Date_</entry>
<entry>what to prefix the var name with</entry>
</row>
<row>
<entry>time</entry>
<entry>timestamp/YYYY-MM-DD</entry>
<entry>No</entry>
<entry>current time in unix timestamp or YYYY-MM-DD
format</entry>
<entry>what date/time to use</entry>
</row>
<row>
<entry>start_year</entry>
<entry>string</entry>
<entry>No</entry>
<entry>current year</entry>
<entry>the first year in the dropdown, either
year number, or relative to current year (+/- N)</entry>
</row>
<row>
<entry>end_year</entry>
<entry>string</entry>
<entry>No</entry>
<entry>same as start_year</entry>
<entry>the last year in the dropdown, either
year number, or relative to current year (+/- N)</entry>
</row>
<row>
<entry>display_days</entry>
<entry>boolean</entry>
<entry>No</entry>
<entry>true</entry>
<entry>whether to display days or not</entry>
</row>
<row>
<entry>display_months</entry>
<entry>boolean</entry>
<entry>No</entry>
<entry>true</entry>
<entry>whether to display months or not</entry>
</row>
<row>
<entry>display_years</entry>
<entry>boolean</entry>
<entry>No</entry>
<entry>true</entry>
<entry>whether to display years or not</entry>
</row>
<row>
<entry>month_format</entry>
<entry>string</entry>
<entry>No</entry>
<entry>%B</entry>
<entry>what format the month should be in (strftime)</entry>
</row>
<row>
<entry>day_format</entry>
<entry>string</entry>
<entry>No</entry>
<entry>%02d</entry>
<entry>what format the day output should be in (sprintf)</entry>
</row>
<row>
<entry>day_value_format</entry>
<entry>string</entry>
<entry>No</entry>
<entry>%d</entry>
<entry>what format the day value should be in (sprintf)</entry>
</row>
<row>
<entry>year_as_text</entry>
<entry>boolean</entry>
<entry>No</entry>
<entry>false</entry>
<entry>whether or not to display the year as text</entry>
</row>
<row>
<entry>reverse_years</entry>
<entry>boolean</entry>
<entry>No</entry>
<entry>false</entry>
<entry>display years in reverse order</entry>
</row>
<row>
<entry>field_array</entry>
<entry>string</entry>
<entry>No</entry>
<entry>null</entry>
<entry>
if a name is given, the select boxes will be drawn
such that the results will be returned to PHP in the
form of name[Day], name[Year], name[Month].
</entry>
</row>
<row>
<entry>day_size</entry>
<entry>string</entry>
<entry>No</entry>
<entry>null</entry>
<entry>adds size attribute to select tag if given</entry>
</row>
<row>
<entry>month_size</entry>
<entry>string</entry>
<entry>No</entry>
<entry>null</entry>
<entry>adds size attribute to select tag if given</entry>
</row>
<row>
<entry>year_size</entry>
<entry>string</entry>
<entry>No</entry>
<entry>null</entry>
<entry>adds size attribute to select tag if given</entry>
</row>
<row>
<entry>all_extra</entry>
<entry>string</entry>
<entry>No</entry>
<entry>null</entry>
<entry>adds extra attributes to all select/input tags if
given</entry>
</row>
<row>
<entry>day_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>month_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>year_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>field_order</entry>
<entry>string</entry>
<entry>No</entry>
<entry>MDY</entry>
<entry>the order in which to display the fields</entry>
</row>
<row>
<entry>field_separator</entry>
<entry>string</entry>
<entry>No</entry>
<entry>\n</entry>
<entry>string printed between different fields</entry>
</row>
<row>
<entry>month_value_format</entry>
<entry>string</entry>
<entry>No</entry>
<entry>%m</entry>
<entry>strftime format of the month values, default is
%m for month numbers.</entry>
</row>
<row>
<entry>year_empty</entry>
<entry>string</entry>
<entry>No</entry>
<entry>null</entry>
<entry>If supplied then the first element of the year's select-box has this
value as it's label and "" as it's value. This is useful to make the
select-box read "Please select a year" for example.
Note that you can use values like "-MM-DD" as time-attribute to indicate
an unselected year.</entry>
2004-04-13 08:46:28 +00:00
</row>
<row>
<entry>month_empty</entry>
2004-04-13 08:46:28 +00:00
<entry>string</entry>
<entry>No</entry>
<entry>null</entry>
<entry>If supplied then the first element of the month's select-box has this
value as it's label and "" as it's value. .
Note that you can use values like "YYYY--DD" as time-attribute to indicate
an unselected month.</entry>
2004-04-13 08:46:28 +00:00
</row>
<row>
<entry>day_empty</entry>
2004-04-13 08:46:28 +00:00
<entry>string</entry>
<entry>No</entry>
<entry>null</entry>
<entry>If supplied then the first element of the day's select-box has this
value as it's label and "" as it's value.
Note that you can use values like "YYYY-MM-" as time-attribute to indicate
an unselected day.</entry>
2004-04-13 08:46:28 +00:00
</row>
</tbody>
</tgroup>
</informaltable>
<para>
html_select_date is a custom function that creates date dropdowns
for you. It can display any or all of year, month, and day.
</para>
<example>
<title>html_select_date</title>
<programlisting>
{html_select_date}
OUTPUT:
&lt;select name="Date_Month"&gt;
&lt;option value="1"&gt;January&lt;/option&gt;
&lt;option value="2"&gt;February&lt;/option&gt;
&lt;option value="3"&gt;March&lt;/option&gt;
&lt;option value="4"&gt;April&lt;/option&gt;
&lt;option value="5"&gt;May&lt;/option&gt;
&lt;option value="6"&gt;June&lt;/option&gt;
&lt;option value="7"&gt;July&lt;/option&gt;
&lt;option value="8"&gt;August&lt;/option&gt;
&lt;option value="9"&gt;September&lt;/option&gt;
&lt;option value="10"&gt;October&lt;/option&gt;
&lt;option value="11"&gt;November&lt;/option&gt;
2004-11-01 10:41:38 +00:00
&lt;option value="12" selected="selected"&gt;December&lt;/option&gt;
2004-04-13 08:46:28 +00:00
&lt;/select&gt;
&lt;select name="Date_Day"&gt;
&lt;option value="1"&gt;01&lt;/option&gt;
&lt;option value="2"&gt;02&lt;/option&gt;
&lt;option value="3"&gt;03&lt;/option&gt;
&lt;option value="4"&gt;04&lt;/option&gt;
&lt;option value="5"&gt;05&lt;/option&gt;
&lt;option value="6"&gt;06&lt;/option&gt;
&lt;option value="7"&gt;07&lt;/option&gt;
&lt;option value="8"&gt;08&lt;/option&gt;
&lt;option value="9"&gt;09&lt;/option&gt;
&lt;option value="10"&gt;10&lt;/option&gt;
&lt;option value="11"&gt;11&lt;/option&gt;
&lt;option value="12"&gt;12&lt;/option&gt;
2004-11-01 10:41:38 +00:00
&lt;option value="13" selected="selected"&gt;13&lt;/option&gt;
2004-04-13 08:46:28 +00:00
&lt;option value="14"&gt;14&lt;/option&gt;
&lt;option value="15"&gt;15&lt;/option&gt;
&lt;option value="16"&gt;16&lt;/option&gt;
&lt;option value="17"&gt;17&lt;/option&gt;
&lt;option value="18"&gt;18&lt;/option&gt;
&lt;option value="19"&gt;19&lt;/option&gt;
&lt;option value="20"&gt;20&lt;/option&gt;
&lt;option value="21"&gt;21&lt;/option&gt;
&lt;option value="22"&gt;22&lt;/option&gt;
&lt;option value="23"&gt;23&lt;/option&gt;
&lt;option value="24"&gt;24&lt;/option&gt;
&lt;option value="25"&gt;25&lt;/option&gt;
&lt;option value="26"&gt;26&lt;/option&gt;
&lt;option value="27"&gt;27&lt;/option&gt;
&lt;option value="28"&gt;28&lt;/option&gt;
&lt;option value="29"&gt;29&lt;/option&gt;
&lt;option value="30"&gt;30&lt;/option&gt;
&lt;option value="31"&gt;31&lt;/option&gt;
&lt;/select&gt;
&lt;select name="Date_Year"&gt;
2004-11-01 10:41:38 +00:00
&lt;option value="2001" selected="selected"&gt;2001&lt;/option&gt;
2004-04-13 08:46:28 +00:00
&lt;/select&gt;</programlisting>
</example>
<example>
<title>html_select_date</title>
<programlisting>
{* start and end year can be relative to current year *}
{html_select_date prefix="StartDate" time=$time start_year="-5" end_year="+1" display_days=false}
OUTPUT: (current year is 2000)
&lt;select name="StartDateMonth"&gt;
&lt;option value="1"&gt;January&lt;/option&gt;
&lt;option value="2"&gt;February&lt;/option&gt;
&lt;option value="3"&gt;March&lt;/option&gt;
&lt;option value="4"&gt;April&lt;/option&gt;
&lt;option value="5"&gt;May&lt;/option&gt;
&lt;option value="6"&gt;June&lt;/option&gt;
&lt;option value="7"&gt;July&lt;/option&gt;
&lt;option value="8"&gt;August&lt;/option&gt;
&lt;option value="9"&gt;September&lt;/option&gt;
&lt;option value="10"&gt;October&lt;/option&gt;
&lt;option value="11"&gt;November&lt;/option&gt;
2004-11-01 10:41:38 +00:00
&lt;option value="12" selected="selected"&gt;December&lt;/option&gt;
2004-04-13 08:46:28 +00:00
&lt;/select&gt;
&lt;select name="StartDateYear"&gt;
2004-11-01 10:41:38 +00:00
&lt;option value="1995"&gt;1995&lt;/option&gt;
&lt;option value="1996"&gt;1996&lt;/option&gt;
&lt;option value="1997"&gt;1997&lt;/option&gt;
&lt;option value="1998"&gt;1998&lt;/option&gt;
2004-04-13 08:46:28 +00:00
&lt;option value="1999"&gt;1999&lt;/option&gt;
2004-11-01 10:41:38 +00:00
&lt;option value="2000" selected="selected"&gt;2000&lt;/option&gt;
2004-04-13 08:46:28 +00:00
&lt;option value="2001"&gt;2001&lt;/option&gt;
&lt;/select&gt;</programlisting>
</example>
</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
-->