Input field functions for templates

2004-05-19 12:00

The functions from this function library is useful for abstracting HTML input fields insite templates. Your template system has to allow PHP code inside templates or to allow calling user-defined functions.

Source code.

Documentation

Variable Summary

TPL_INPUT_BEGIN HTML that is used before input label
TPL_INPUT_END HTML that is used after field HTML
TPL_INPUT_MONTH_LABELS Month label array
TPL_INPUT_SEPARATOR HTML that is used between label and field HTML
TPL_INPUT_SMART_LABELS Can tpl_inputs apply smart formating to labels?

Function Summary
string tpl_input([string $label], [string $field], [string $before_field], [string $after_field])
Generates HTML for form input
string tpl_input_date(string $label, string $prefix, [string $format], [mixed $value], [mixed $default_value], [integer $year_from], [integer $year_to], [string $extra], [string $before], [string $after])
Generates date input field HTML
string tpl_input_file(string $label, string $name, [string $value], [string $extra], [string $before], [string $after])
Generates file input field HTML
string tpl_input_multiple(string $label, string $name, mixed $values, [mixed $labels], [mixed $checked], [boolean $vertical], [string $extra], [string $before], [string $after])
Generates multiple radio input field HTML
string tpl_input_password(string $label, string $name, [string $value], [string $extra], [string $before], [string $after])
Generates type=”password” input field HTML
string tpl_input_select(string $label, string $name, mixed $values, [mixed $labels], [string $value], [string $extra], [string $before], [string $after])
Generates select input field HTML
string tpl_input_text(string $label, string $name, [string $value], [string $extra], [string $before], [string $after])
Generates type=”text” input field HTML
string tpl_input_textarea(string $label, string $name, [string $value], [string $extra], [string $before], [string $after])
Generates textarea input field HTML

Variable Detail

TPL_INPUT_BEGIN

string $TPL_INPUT_BEGIN

HTML that is used before input label


TPL_INPUT_END

boolean $TPL_INPUT_END

Can tpl_inputs apply smart formating to labels?


TPL_INPUT_MONTH_LABELS

array $TPL_INPUT_MONTH_LABELS

Month label array


TPL_INPUT_SEPARATOR

string $TPL_INPUT_SEPARATOR

HTML that is used between label and field HTML


TPL_INPUT_SMART_LABELS

boolean $TPL_INPUT_SMART_LABELS

Can tpl_inputs apply smart formating to labels?


Function Detail

tpl_input()

string tpl_input([string $label], [string $field], [string $before_field], [string $after_field])

Generates HTML for form input

Parameters:
label – Input field label
field – Form field HTML
before_field – HTML to prepend to field
after_field – HTML to append to form field
Returns:
HTML
Uses the global variables:
TPL_INPUT_BEGIN, TPL_INPUT_SMART_LABELS, TPL_INPUT_END, TPL_INPUT_SEPARATOR

tpl_input_date()

string tpl_input_date(string $label, string $prefix, [string $format], [mixed $value], [mixed $default_value], [integer $year_from], [integer $year_to], [string $extra], [string $before], [string $after])

Generates date input field HTML

Parameters:
label – field label
prefix – form field name prefix
format – Format for input field
value – field value
default_value – default field value (defaults to now, if null empty value will be preselected)
year_from – year select box min value
year_to – year select box max value
extra – extra attributes for form field
before – HTML to prepend before form field
after – HTML to append after form field
Returns:
HTML

tpl_input_file()

string tpl_input_file(string $label, string $name, [string $value], [string $extra], [string $before], [string $after])

Generates file input field HTML

Parameters:
label – field label
name – form field name
value – form field value
extra – extra attributes for form field
before – HTML to prepend before form field
after – HTML to append after form field
Returns:
HTML

tpl_input_multiple()

string tpl_input_multiple(string $label, string $name, mixed $values, [mixed $labels], [mixed $checked], [boolean $vertical], [string $extra], [string $before], [string $after])

Generates multiple radio input field HTML

Parameters:
label – field label
name – form field name
values – option value list
labels – option label list
checked – selected form field value
vertical – should the radio inputs be presented in vertical (default FALSE)
extra – extra attributes for form field
before – HTML to prepend before form field
after – HTML to append after form field
Returns:
HTML

tpl_input_password()

string tpl_input_password(string $label, string $name, [string $value], [string $extra], [string $before], [string $after])

Generates type=”password” input field HTML

Parameters:
label – field label
name – form field name
value – form field value
extra – extra attributes for form field
before – HTML to prepend before form field
after – HTML to append after form field
Returns:
HTML

tpl_input_select()

string tpl_input_select(string $label, string $name, mixed $values, [mixed $labels], [string $value], [string $extra], [string $before], [string $after])

Generates select input field HTML

Parameters:
label – field label
name – form field name
values – option value list
labels – option label list
value – form field value
extra – extra attributes for form field
before – HTML to prepend before form field
after – HTML to append after form field
Returns:
HTML

tpl_input_text()

string tpl_input_text(string $label, string $name, [string $value], [string $extra], [string $before], [string $after])

Generates type=”text” input field HTML

Parameters:
label – field label
name – form field name
value – form field value
extra – extra attributes for form field
before – HTML to prepend before form field
after – HTML to append after form field
Returns:
HTML

tpl_input_textarea()

string tpl_input_textarea(string $label, string $name, [string $value], [string $extra], [string $before], [string $after])

Generates textarea input field HTML

Parameters:
label – field label
name – form field name
value – form field value
extra – extra attributes for form field
before – HTML to prepend before form field
after – HTML to append after form field
Returns:
HTML

Documentation was generated by phpdocgen 0.17-rc3.
Copyright © 2002-03 Stéphane GALLAND (under the GNU General Public License)