<html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <title>{html_select_date}</title> <meta name="generator" content="DocBook XSL Stylesheets V1.75.1"> <link rel="home" href="index.html" title="Smarty Manual"> <link rel="up" href="language.custom.functions.html" title="Chapter 8. Custom Functions"> <link rel="prev" href="language.function.html.radios.html" title="{html_radios}"> <link rel="next" href="language.function.html.select.time.html" title="{html_select_time}"> </head> <body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"> <div class="navheader"> <table width="100%" summary="Navigation header"> <tr><th colspan="3" align="center">{html_select_date}</th></tr> <tr> <td width="20%" align="left"> <a accesskey="p" href="language.function.html.radios.html">Prev</a> </td> <th width="60%" align="center">Chapter 8. Custom Functions</th> <td width="20%" align="right"> <a accesskey="n" href="language.function.html.select.time.html">Next</a> </td> </tr> </table> <hr> </div> <div class="sect1" title="{html_select_date}"> <div class="titlepage"><div><div><h2 class="title" style="clear: both"> <a name="language.function.html.select.date"></a>{html_select_date}</h2></div></div></div> <p> <code class="varname">{html_select_date}</code> is a <a class="link" href="language.custom.functions.html" title="Chapter 8. Custom Functions">custom function</a> that creates date dropdowns. It can display any or all of year, month, and day. All parameters that are not in the list below are printed as name/value-pairs inside the <code class="literal"><select></code> tags of day, month and year. </p> <div class="informaltable"><table border="1"> <colgroup> <col align="center"> <col align="center"> <col align="center"> <col align="center"> <col> </colgroup> <thead><tr> <th align="center">Attribute Name</th> <th align="center">Type</th> <th align="center">Required</th> <th align="center">Default</th> <th>Description</th> </tr></thead> <tbody> <tr> <td align="center">prefix</td> <td align="center">string</td> <td align="center">No</td> <td align="center">Date_</td> <td>What to prefix the var name with</td> </tr> <tr> <td align="center">time</td> <td align="center">timestamp/ YYYY-MM-DD</td> <td align="center">No</td> <td align="center">current time in unix timestamp or YYYY-MM-DD format</td> <td>What date/time to use</td> </tr> <tr> <td align="center">start_year</td> <td align="center">string</td> <td align="center">No</td> <td align="center">current year</td> <td>The first year in the dropdown, either year number, or relative to current year (+/- N)</td> </tr> <tr> <td align="center">end_year</td> <td align="center">string</td> <td align="center">No</td> <td align="center">same as start_year</td> <td>The last year in the dropdown, either year number, or relative to current year (+/- N)</td> </tr> <tr> <td align="center">display_days</td> <td align="center">boolean</td> <td align="center">No</td> <td align="center"><code class="constant">TRUE</code></td> <td>Whether to display days or not</td> </tr> <tr> <td align="center">display_months</td> <td align="center">boolean</td> <td align="center">No</td> <td align="center"><code class="constant">TRUE</code></td> <td>Whether to display months or not</td> </tr> <tr> <td align="center">display_years</td> <td align="center">boolean</td> <td align="center">No</td> <td align="center"><code class="constant">TRUE</code></td> <td>Whether to display years or not</td> </tr> <tr> <td align="center">month_format</td> <td align="center">string</td> <td align="center">No</td> <td align="center">%B</td> <td>What format the month should be in (strftime)</td> </tr> <tr> <td align="center">day_format</td> <td align="center">string</td> <td align="center">No</td> <td align="center">%02d</td> <td>What format the day output should be in (sprintf)</td> </tr> <tr> <td align="center">day_value_format</td> <td align="center">string</td> <td align="center">No</td> <td align="center">%d</td> <td>What format the day value should be in (sprintf)</td> </tr> <tr> <td align="center">year_as_text</td> <td align="center">boolean</td> <td align="center">No</td> <td align="center"><code class="constant">FALSE</code></td> <td>Whether or not to display the year as text</td> </tr> <tr> <td align="center">reverse_years</td> <td align="center">boolean</td> <td align="center">No</td> <td align="center"><code class="constant">FALSE</code></td> <td>Display years in reverse order</td> </tr> <tr> <td align="center">field_array</td> <td align="center">string</td> <td align="center">No</td> <td align="center">null</td> <td> 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]. </td> </tr> <tr> <td align="center">day_size</td> <td align="center">string</td> <td align="center">No</td> <td align="center">null</td> <td>Adds size attribute to select tag if given</td> </tr> <tr> <td align="center">month_size</td> <td align="center">string</td> <td align="center">No</td> <td align="center">null</td> <td>Adds size attribute to select tag if given</td> </tr> <tr> <td align="center">year_size</td> <td align="center">string</td> <td align="center">No</td> <td align="center">null</td> <td>Adds size attribute to select tag if given</td> </tr> <tr> <td align="center">all_extra</td> <td align="center">string</td> <td align="center">No</td> <td align="center">null</td> <td>Adds extra attributes to all select/input tags if given</td> </tr> <tr> <td align="center">day_extra</td> <td align="center">string</td> <td align="center">No</td> <td align="center">null</td> <td>Adds extra attributes to select/input tags if given</td> </tr> <tr> <td align="center">month_extra</td> <td align="center">string</td> <td align="center">No</td> <td align="center">null</td> <td>Adds extra attributes to select/input tags if given</td> </tr> <tr> <td align="center">year_extra</td> <td align="center">string</td> <td align="center">No</td> <td align="center">null</td> <td>Adds extra attributes to select/input tags if given</td> </tr> <tr> <td align="center">field_order</td> <td align="center">string</td> <td align="center">No</td> <td align="center">MDY</td> <td>The order in which to display the fields</td> </tr> <tr> <td align="center">field_separator</td> <td align="center">string</td> <td align="center">No</td> <td align="center">\n</td> <td>String printed between different fields</td> </tr> <tr> <td align="center">month_value_format</td> <td align="center">string</td> <td align="center">No</td> <td align="center">%m</td> <td>strftime() format of the month values, default is %m for month numbers.</td> </tr> <tr> <td align="center">year_empty</td> <td align="center">string</td> <td align="center">No</td> <td align="center">null</td> <td>If supplied then the first element of the year's select-box has this value as it's label and <span class="quote">“<span class="quote"></span>”</span> as it's value. This is useful to make the select-box read <span class="quote">“<span class="quote">Please select a year</span>”</span> for example. Note that you can use values like <span class="quote">“<span class="quote">-MM-DD</span>”</span> as time-attribute to indicate an unselected year.</td> </tr> <tr> <td align="center">month_empty</td> <td align="center">string</td> <td align="center">No</td> <td align="center">null</td> <td>If supplied then the first element of the month's select-box has this value as it's label and <span class="quote">“<span class="quote"></span>”</span> as it's value. . Note that you can use values like <span class="quote">“<span class="quote">YYYY--DD</span>”</span> as time-attribute to indicate an unselected month.</td> </tr> <tr> <td align="center">day_empty</td> <td align="center">string</td> <td align="center">No</td> <td align="center">null</td> <td>If supplied then the first element of the day's select-box has this value as it's label and <span class="quote">“<span class="quote"></span>”</span> as it's value. Note that you can use values like <span class="quote">“<span class="quote">YYYY-MM-</span>”</span> as time-attribute to indicate an unselected day.</td> </tr> </tbody> </table></div> <div class="note" title="Note" style="margin-left: 0.5in; margin-right: 0.5in;"> <h3 class="title">Note</h3> <p> There is an useful php function on the <a class="link" href="tips.dates.html" title="Dates">date tips page</a> for converting <code class="varname">{html_select_date}</code> form values to a timestamp. </p> </div> <div class="example"> <a name="id3072219"></a><p class="title"><b>Example 8.19. {html_select_date}</b></p> <div class="example-contents"> <p>Template code</p> <pre class="programlisting"> {html_select_date} </pre> <p> This will output: </p> <pre class="screen"> <select name="Date_Month"> <option value="1">January</option> <option value="2">February</option> <option value="3">March</option> ..... snipped ..... <option value="10">October</option> <option value="11">November</option> <option value="12" selected="selected">December</option> </select> <select name="Date_Day"> <option value="1">01</option> <option value="2">02</option> <option value="3">03</option> ..... snipped ..... <option value="11">11</option> <option value="12">12</option> <option value="13" selected="selected">13</option> <option value="14">14</option> <option value="15">15</option> ..... snipped ..... <option value="29">29</option> <option value="30">30</option> <option value="31">31</option> </select> <select name="Date_Year"> <option value="2006" selected="selected">2006</option> </select> </pre> </div> </div> <br class="example-break"><div class="example"> <a name="id3072246"></a><p class="title"><b>Example 8.20. {html_select_date} second example</b></p> <div class="example-contents"> <pre class="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} </pre> <p> With 2000 as the current year the output: </p> <pre class="screen"> <select name="StartDateMonth"> <option value="1">January</option> <option value="2">February</option> .... snipped .... <option value="11">November</option> <option value="12" selected="selected">December</option> </select> <select name="StartDateYear"> <option value="1995">1995</option> .... snipped .... <option value="1999">1999</option> <option value="2000" selected="selected">2000</option> <option value="2001">2001</option> </select> </pre> </div> </div> <br class="example-break"><p> See also <a class="link" href="language.function.html.select.time.html" title="{html_select_time}"><code class="varname">{html_select_time}</code></a>, <a class="link" href="language.modifier.date.format.html" title="date_format"><code class="varname">date_format</code></a>, <a class="link" href="language.variables.smarty.html#language.variables.smarty.now" title="{$smarty.now}"><em class="parameter"><code>$smarty.now</code></em></a> and the <a class="link" href="tips.dates.html" title="Dates">date tips page</a>. </p> </div> <div class="navfooter"> <hr> <table width="100%" summary="Navigation footer"> <tr> <td width="40%" align="left"> <a accesskey="p" href="language.function.html.radios.html">Prev</a> </td> <td width="20%" align="center"><a accesskey="u" href="language.custom.functions.html">Up</a></td> <td width="40%" align="right"> <a accesskey="n" href="language.function.html.select.time.html">Next</a> </td> </tr> <tr> <td width="40%" align="left" valign="top">{html_radios} </td> <td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td> <td width="40%" align="right" valign="top"> {html_select_time}</td> </tr> </table> </div> </body> </html>