Actions

API15

JHTMLList/section

From Joomla! Documentation

< API15:JHTMLList
Revision as of 17:21, 22 March 2010 by Doxiki (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
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

Select list of active sections

[Edit Descripton]

Description:JHTMLList/section

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;
}

[Edit See Also] SeeAlso:JHTMLList/section

Examples

<CodeExamplesForm />