JHtmlMenu/ordering: Difference between revisions
From Joomla! Documentation
m clean up |
m preparing for archive only |
||
| Line 63: | Line 63: | ||
===Examples=== | ===Examples=== | ||
=== Code Examples === | |||
<dpl> | <dpl> | ||
noresultsheader=\n | noresultsheader=\n | ||
category=ordering | category=ordering | ||
category=JHtmlMenu | category=JHtmlMenu | ||
namespace=CodeExample | |||
category=MethodExample | category=MethodExample | ||
include=* | include=* | ||
Latest revision as of 01:46, 25 March 2017
Description
Build the select list for Menu Ordering
<! removed transcluded page call, red link never existed >
Syntax
static ordering(&$row, $id)
| Parameter Name | Default Value | Description |
|---|---|---|
| &$row | ||
| $id |
Defined in
libraries/joomla/html/html/menu.php
Importing
jimport( 'joomla.html.html.menu' );
Source Body
public static function ordering(&$row, $id)
{
$db = &JFactory::getDbo();
if ($id)
{
$query = 'SELECT ordering AS value, title AS text'
. ' FROM #__menu'
. ' WHERE menutype = '.$db->Quote($row->menutype)
. ' AND parent_id = '.(int) $row->parent_id
. ' AND published != -2'
. ' ORDER BY ordering';
$order = JHtml::_('list.genericordering', $query);
$ordering = JHtml::_(
'select.genericlist',
$order,
'ordering',
array('list.attr' => 'class="inputbox" size="1"', 'list.select' => intval($row->ordering))
);
}
else
{
$ordering = '<input type="hidden" name="ordering" value="'. $row->ordering .'" />'. JText::_('JCOMMON_NEWITEMSLAST_DESC');
}
return $ordering;
}
<! removed transcluded page call, red link never existed >
Examples
Code Examples