API15

JHTMLSelect/integerlist

From Joomla! Documentation

< API15:JHTMLSelect
Revision as of 13:30, 12 May 2013 by JoomlaWikiBot (talk | contribs) (removing red link to edit, no existant pages)

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 a select list of integers

[<! removed edit link to red link >]

<! removed transcluded page call, red link never existed >

Syntax[edit]

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
$selected null The key that is selected
$format "" The printf format to be applied to the number

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 integerlist( $start, $end, $inc, $name, $attribs = null, $selected = null, $format = "" )
{
        $start  = intval( $start );
        $end    = intval( $end );
        $inc    = intval( $inc );
        $arr    = array();

        for ($i=$start; $i <= $end; $i+=$inc)
        {
                $fi = $format ? sprintf( "$format", $i ) : "$i";
                $arr[] = JHTML::_('select.option',  $fi, $fi );
        }

        return JHTML::_('select.genericlist',   $arr, $name, $attribs, 'value', 'text', $selected );
}

[<! removed edit link to red link >] <! removed transcluded page call, red link never existed >

Examples[edit]

<CodeExamplesForm />