Actions

API16

JHtmlList/ordering

From Joomla! Documentation

< API16:JHtmlList
Replacement filing cabinet.png
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

Build the select list for Ordering derived from a query

[<! removed edit link to red link >]

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

Syntax

static ordering($name, $query, $attribs=null, $selected=null, $neworder=null, $chop=null)
Parameter Name Default Value Description
$name $value The scalar value
$query $query
$attribs null $attribs HTML tag attributes
$selected null $neworder 1 if new and first, -1 if new and last, 0 or null if existing item
$neworder null $prefix An optional prefix for the task
$chop null

Returns

string

Defined in

libraries/joomla/html/html/list.php

Importing

jimport( 'joomla.html.html.list' );

Source Body

public static function ordering($name, $query, $attribs = null, $selected = null, $neworder = null, $chop = null)
{
        if (empty($attribs)) {
                $attribs = 'class="inputbox" size="1"';
        }
 
        if (empty($neworder))
        {
                $orders = JHtml::_('list.genericordering', $query);
                $html   = JHtml::_(
                        'select.genericlist',
                        $orders,
                        $name,
                        array('list.attr' => $attribs, 'list.select' => (int) $selected)
                );
        }
        else
        {
                if ($neworder > 0) {
                        $text = JText::_('descNewItemsFirst');
                }
                else if ($neworder <= 0) {
                        $text = JText::_('JCOMMON_NEWITEMSLAST_DESC');
                }
                $html = '<input type="hidden" name="'.$name.'" value="'. (int) $selected .'" />'. $text;
        }
        return $html;
}

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

Examples

<CodeExamplesForm />