html_select_timezone
A smarty plugin for use within forms which displays a drop-down list of timezones
Attribute Name Type Default Description
variables
defaultmixedGMTThe default zone to select 1
extrastringAny extra attributes 2
functionstring(built-in default)The name of the function used to get the zone data 3
returnstringdefaultThe return type 4
attributes
nameCDATAfield name 5
sizeNUMBERrows visible
multiple(multiple)default is single selection 6
disabled(disabled)unavailable in this context 7
tabindexNUMBERposition in tabbing order
onfocus%script%the element got the focus
onblur%script%the element lost the focus
onchange%script%the element value was changed
coreattrs
idIDdocument-wide unique id
classCDATAspace-separated list of classes
style%stylesheet%associated style info
title%text%advisory title
i18n
lang%languagecode%language code
dir(ltr|rtl)direction for weak/neutral text
events
onclick%script%a pointer button was clicked
ondblclick%script%a pointer button was double clicked
onmousedown%script%a pointer button was pressed down
onmouseup%script%a pointer button was released
onmouseover%script%a pointer was moved onto
onmousemove%script%a pointer was moved within
onmouseout%script%a pointer was moved away
onkeypress%script%a key was pressed and released
onkeydown%script%a key was pressed down
onkeyup%script%a key was released
Notes
  1. default

    The default can be specified in two ways:

  2. extra

    If you need to pass any extra tags to the actual <select...> statement, this is the place to do it. For example:
  3. {html_select_timezone extra="width=200 alt=TimeZone"}
  4. function

    If you want to use a different function to get the zone data, this is where you can specify it's name. The function itself should return an array of zone data in the following format:
    array[0..n] of array( "name", offset )
    Where name is the zone name, and offset is the offset in minutes from GMT.

  5. return

    This is the return type; the actual value that will be returned along with the rest of the form's controls. It should be one of the following:


  6. name

    I've intentionally not used a default value for this, in order to comply to HTML 4.01 standards. So, in order for the containing form to return data from this <select...> statement, you must pass an appropriate vale for this.

  7. multiple

    If you wish to use this facility, although why you would ever want escapes me, use something like the following:
    {html_select_timezone multiple="multiple"}
  8. disabled

    If you wish to use this facility, use something like the following:
    {html_select_timezone disable="disabled"}
Example
	{assign var="timezone" value=$timezone|default:"GMT"}
	{html_select_timezone name="timezone" default="$timezone" style="background-color:orange;" size="7"}

	

	<select name="timezone" style="background-color:orange" size="7">
		<option value="0|ACT|570">ACT</option>
		<option value="1|AET|600">AET</option>
		<option value="2|Africa/Abidjan|0">Africa/Abidjan</option>
		...
		<option value="424|Europe/Zurich|60">Europe/Zurich</option>
		<option value="425|GB|0">GB</option>
		<option value="426|GB-Eire|0">GB-Eire</option>
		<option value="427|GMT|0" selected="selected">GMT</option>
		<option value="428|GMT0|0">GMT0</option>
		<option value="429|Greenwich|0">Greenwich</option>
		<option value="430|Hongkong|480">Hongkong</option>
		...
		<option value="550|WET|0">WET</option>
		<option value="551|W-SU|180">W-SU</option>
		<option value="552|Zulu|0">Zulu</option>
	</select>
Caveats
BEWARE: This function is quite capable of adding around 32K of data to your page. You should therefore use it sparingly in order to conserve bandwidth.
REMEMBER: In order for your form to return time zone data, you MUST supply the `name` attribute.

Copyright (c) 2002, Alan McFarlane