/** * Generates an HTML select list * * @param array An array of objects * @param string The value of the HTML name attribute * @param string Additional HTML attributes for the <select> tag * @param string The name of the object variable for the option value * @param string The name of the object variable for the option text * @param mixed The key that is selected (accepts an array or a string) * @returns string HTML for the select list */ function genericlist($arr, $name, $attribs = null, $key = 'value', $text = 'text', $selected = NULL, $idtag = false, $translate = false) { if (is_array($arr)) { reset($arr); } if (is_array($attribs)) { $attribs = JArrayHelper::toString($attribs); } $id = $name; if ($idtag) { $id = $idtag; } $id = str_replace('[', '', $id); $id = str_replace(']', '', $id); $html = '<select name="' . $name . '" id="' . $id . '" ' . $attribs . '>'; $html .= JHTMLSelect::Options($arr, $key, $text, $selected, $translate); $html .= '</select>'; return $html; }