I was thinking of building a 'form helper'
A bunch of methods that output parts of forms.
eg: a dropdown list or group of radio buttons.
I could then simply send the complete dropdown list to the template
without needing to use the template for iterating over arrays and
testing for values.
eg: a select item for a form might look like this...
function buildSelect($array, $name, $selected=''){
$ret = "<select name='$name'>";
foreach($array as $item)
{
$ret .= '<option value="'.$item.'"';
$ret .= ($item == $selected) ? 'SELECTED' ? '';
$ret .= '</option>';
}
}
currently I am doing this in the template after sending the array, and
other values to the template. So, is this a better way, or is the
template the proper place for this? If I did things this way, would
ezcBaseStruct be the best way of passing the form 'elements' to the
template?
Kind regards
Kevin
--
Components mailing list
[email protected]
http://lists.ez.no/mailman/listinfo/components