API15:JHTMLList/section
From Joomla! Documentation
Description
Select list of active sections
[<! removed edit link to red link >]
<! removed transcluded page call, red link never existed >
Syntax
section($name, $active=NULL, $javascript=NULL, $order= 'ordering', $uncategorized=true, $scope= 'content')
| Parameter Name | Default Value | Description |
|---|---|---|
| $name | ||
| $active | NULL | |
| $javascript | NULL | |
| $order | 'ordering' | |
| $uncategorized | true | |
| $scope | 'content' |
Defined in
libraries/joomla/html/html/list.php
Importing
jimport( 'joomla.html.html.list' );
Source Body
function section( $name, $active = NULL, $javascript = NULL, $order = 'ordering', $uncategorized = true, $scope = 'content' )
{
$db =& JFactory::getDBO();
$categories[] = JHTML::_('select.option', '-1', '- '. JText::_( 'Select Section' ) .' -' );
if ($uncategorized) {
$categories[] = JHTML::_('select.option', '0', JText::_( 'Uncategorized' ) );
}
$query = 'SELECT id AS value, title AS text'
. ' FROM #__sections'
. ' WHERE published = 1'
. ' AND scope = ' . $db->Quote($scope)
. ' ORDER BY ' . $order
;
$db->setQuery( $query );
$sections = array_merge( $categories, $db->loadObjectList() );
$category = JHTML::_('select.genericlist', $sections, $name, 'class="inputbox" size="1" '. $javascript, 'value', 'text', $active );
return $category;
}
[<! removed edit link to red link >] <! removed transcluded page call, red link never existed >
Examples
Code Examples