API16:JHtmlSelect/integerlist
From Joomla! Documentation
This Namespace has been archived - Please Do Not Edit or Create Pages in this namespace. Pages contain information for a Joomla! version which is no longer supported. It exists only as a historical reference, will not be improved and its content may be incomplete.
Contents |
Description
Generates a selection list of integers.
[<! removed edit link to red link >]
<! removed transcluded page call, red link never existed >
Syntax
static integerlist($start, $end, $inc, $name, $attribs=null, $selected=null, $format= '')
| Parameter Name | Default Value | Description |
|---|---|---|
| $start | The start integer | |
| $end | The end integer | |
| $inc | The increment | |
| $name | The value of the HTML name attribute | |
| $attribs | null | Additional HTML attributes for the <select> tag, an array of attributes, or an array of options. Treated as options if it is the last argument passed. |
| $selected | null | The key that is selected |
| $format | The printf format to be applied to the number |
Returns
string HTML for the select list
Defined in
libraries/joomla/html/html/select.php
Importing
jimport( 'joomla.html.html.select' );
Source Body
public static function integerlist( $start, $end, $inc, $name, $attribs = null, $selected = null, $format = '' ) { // Set default options $options = array_merge( JHtml::$formatOptions, array( 'format.depth' => 0, 'option.format' => '', 'id' => null, ) ); if (is_array($attribs) && func_num_args() == 5) { // Assume we have an options array $options = array_merge($options, $attribs); // Extract the format and remove it from downstream options $format = $options['option.format']; unset($options['option.format']); } else { // Get options from the parameters $options['list.attr'] = $attribs; $options['list.select'] = $selected; } $start = intval($start); $end = intval($end); $inc = intval($inc); $data = array(); for ($i = $start; $i <= $end; $i += $inc) { $data[$i] = $format ? sprintf($format, $i) : $i; } // Tell genericlist() to use array keys $options['option.key'] = null; return JHtml::_('select.genericlist', $data, $name, $options); }
[<! removed edit link to red link >] <! removed transcluded page call, red link never existed >
Examples
<CodeExamplesForm />
