Difference between revisions of "JHTMLSelect/genericlist"
From Joomla! Documentation
< API15:JHTMLSelect
(New page: ===Description===
Generates an HTML select list
<span class="editsection" style="font-size:76%;">
<nowiki>[</nowiki>Edit Descripton<nowiki>]</n...) |
m (removing red link to edit, no existant pages) |
||
Line 3: | Line 3: | ||
<span class="editsection" style="font-size:76%;"> | <span class="editsection" style="font-size:76%;"> | ||
− | <nowiki>[< | + | <nowiki>[<! removed edit link to red link >]</nowiki> |
</span> | </span> | ||
− | + | <! removed transcluded page call, red link never existed > | |
===Syntax=== | ===Syntax=== | ||
Line 88: | Line 88: | ||
<span class="editsection" style="font-size:76%;"> | <span class="editsection" style="font-size:76%;"> | ||
− | <nowiki>[< | + | <nowiki>[<! removed edit link to red link >]</nowiki> |
</span> | </span> | ||
− | + | <! removed transcluded page call, red link never existed > | |
===Examples=== | ===Examples=== | ||
Line 103: | Line 103: | ||
format= ,,, | format= ,,, | ||
</dpl> | </dpl> | ||
+ | [[Category:Archived pages API15]] |
Revision as of 13:30, 12 May 2013
The "API15" namespace is an archived namespace. This page contains information for a Joomla! version which is no longer supported. It exists only as a historical reference, it will not be improved and its content may be incomplete and/or contain broken links.
Description[edit]
Generates an HTML select list
[<! removed edit link to red link >]
<! removed transcluded page call, red link never existed >
Syntax[edit]
genericlist($arr, $name, $attribs=null, $key= 'value', $text= 'text', $selected=NULL, $idtag=false, $translate=false)
Parameter Name | Default Value | Description |
---|---|---|
$arr | An array of objects | |
$name | The value of the HTML name attribute | |
$attribs | null | Additional HTML attributes for the <select> tag |
$key | 'value' | The name of the object variable for the option value |
$text | 'text' | The name of the object variable for the option text |
$selected | NULL | The key that is selected (accepts an array or a string) |
$idtag | false | |
$translate | false |
Returns[edit]
string HTML for the select list
Defined in[edit]
libraries/joomla/html/html/select.php
Importing[edit]
jimport( 'joomla.html.html.select' );
Source Body[edit]
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;
}
[<! removed edit link to red link >] <! removed transcluded page call, red link never existed >
Examples[edit]
<CodeExamplesForm />