This class is designed to make generating HTML output in MDPro
very simple and also allow for much greater control of output
by the site administrator.
Example
// Information array
$colors = array(array('id' => 1,
'name' => 'Red',
'encoding' => 'ff0000'),
array('id' => 2,
'name' => 'Blue',
'encoding' => '00ff00'),
array('id' => 3,
'name' => 'Green',
'encoding' => '0000ff'));
// Create the HTML object and start it
$myhtml = new pnHTML();
$myhtml->Start();
// Add table showing encoding information
$myhtml->TableStart('Colors and Their Encodings', array('Color', 'Encoding'));
foreach ($colors as $color) {
$info = array($color['name'], $color['encoding']);
$myhtml->TableAddRow($info);
}
$myhtml->TableEnd();
// Add form to select a color
$myhtml->Text('<P><P>');
$myhtml->FormStart('colorchosen.php');
$myhtml->Text('Select a color: ');
$myhtml->FormList('chosen', $colorinfo);
$myhtml->FormSubmit('That\'s the color I want');
$myhtml->FormEnd();
// End the HTML object and print it
$myhtml->End();
$myhtml->PrintPage();
Add HTML tags for a select field as part of a form.
Tags:
return:
An HTML string if
1 ReturnHTML()
has been called, otherwise null
since:
1.13 - 2002/01/23
access:
public
Parameters:
string
$fieldname
the name of the select field
array
$data
an array containing the data for the list. Each array
entry is itself an array, containing the values for
1 'id'
(the value returned if the entry is selected),
1 'name'
(the string displayed for this entry) and
1 'selected'
(optional,
1 1
if this option is selected)
integer
$multiple
(optional)
1 1
if the user is allowed to make multiple selections
integer
$size
(optional) the number of entries that are visible in
the select at any one time. Note that if the number of
actual items is less than this value then the select box
will shrink automatically to the correct size