API16:JHtmlList/ordering
From Joomla! Documentation
Description
Build the select list for Ordering derived from a query
<! 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 transcluded page call, red link never existed >
Examples
Code Examples