Packageindex Classtrees Modulegroups Elementlist Report XML Files

XTPL Template Engine - XTPL

SelectTag

HtmlTag
   |
  +-- SelectTag

public class SelectTag extends HtmlTag

Select tag PHP wrapper. Provides creation of SelectTag objects from arrays
by one call.

Authors Vladimir Sibirov <trustware@bk.ru>
Version XTPL, v.1.2
 

Methods inherited from HtmlTag

htmltag, insert, remove, getcode, parse

Public Method Summary

void

SelectTag(string $name, array $data_array, [ integer $checked ])

Creates a new HtmlTag object from data array. $data_array can be of 2 types.

Fields inherited from HtmlTag

$attr, $tag, $content

Public Method Details

SelectTag

public void SelectTag( string $name, array $data_array, [ integer $checked ] )

  Creates a new HtmlTag object from data array. $data_array can be of 2 types.
First is simple enumerated or associative array. In this case array idexes willbe used as 'value' attributes for the options. And the values will be used ascontent for the option tags.
Example:
<?
$countries
['en'] = 'England';
$countries['ru'] = 'Russia';
$sel = new SelectTag('country', $countries);
$sel->Parse();
// Output: <select name="country"><option value="en">England</option>
// <option value="ru">Russia></option></select>
?>

Another way it can process 2d arrays. The scheme is rather hard, but this was designed foruse with SDQLDB::RowTable() and SQLDB::ArrayTable() methods.
Example:
<?
$countries
[0]['id'] = 'en';
$countries[0]['name'] = 'England';
$countries[1]['id'] = 'ru';
$countries[1]['name'] = 'Russia';
$sel = new SelectTag('country', $countries);
$sel->Parse();
// Output: <select name="country"><option value="en">England</option>
// <option value="ru">Russia></option></select>
?>

Parameter
string $name
Name attribute for the select.
array $data_array
Data.
integer $checked = >>0<<
Number of field which is checked.
Returns void



Packageindex Classtrees Modulegroups Elementlist Report XML Files
PHPDoc 1.0beta