API15

Difference between revisions of "JHTMLList/category"

From Joomla! Documentation

< API15:JHTMLList
(New page: ===Description=== Select list of active categories for components <span class="editsection" style="font-size:76%;"> <nowiki>[</nowiki>[[Description:JHTMLList/category|Edit Descripton...)
 
m (removing red link to edit, no existant pages)
Line 3: Line 3:
  
 
<span class="editsection" style="font-size:76%;">
 
<span class="editsection" style="font-size:76%;">
<nowiki>[</nowiki>[[Description:JHTMLList/category|Edit Descripton]]<nowiki>]</nowiki>
+
<nowiki>[<! removed edit link to red link >]</nowiki>
 
</span>
 
</span>
  
{{Description:JHTMLList/category}}
+
<! removed transcluded page call, red link never existed >
  
 
===Syntax===
 
===Syntax===
Line 77: Line 77:
  
 
<span class="editsection" style="font-size:76%;">
 
<span class="editsection" style="font-size:76%;">
<nowiki>[</nowiki>[[SeeAlso:JHTMLList/category|Edit See Also]]<nowiki>]</nowiki>
+
<nowiki>[<! removed edit link to red link >]</nowiki>
 
</span>
 
</span>
{{SeeAlso:JHTMLList/category}}
+
<! removed transcluded page call, red link never existed >
  
 
===Examples===
 
===Examples===
Line 92: Line 92:
 
  format= ,,,
 
  format= ,,,
 
</dpl>
 
</dpl>
 +
[[Category:Archived pages API15]]

Revision as of 13:30, 12 May 2013

The "API15" namespace is an archived namespace. This page contains information for a Joomla! version which is no longer supported. It exists only as a historical reference, it will not be improved and its content may be incomplete and/or contain broken links.

Description[edit]

Select list of active categories for components

[<! removed edit link to red link >]

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

Syntax[edit]

category($name, $section, $active=NULL, $javascript=NULL, $order= 'ordering', $size=1, $sel_cat=1)
Parameter Name Default Value Description
$name
$section
$active NULL
$javascript NULL
$order 'ordering'
$size 1
$sel_cat 1

Defined in[edit]

libraries/joomla/html/html/list.php

Importing[edit]

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

Source Body[edit]

function category( $name, $section, $active = NULL, $javascript = NULL, $order = 'ordering', $size = 1, $sel_cat = 1 )
{
        $db =& JFactory::getDBO();

        $query = 'SELECT id AS value, title AS text'
        . ' FROM #__categories'
        . ' WHERE section = '.$db->Quote($section)
        . ' AND published = 1'
        . ' ORDER BY '. $order
        ;
        $db->setQuery( $query );
        if ( $sel_cat ) {
                $categories[] = JHTML::_('select.option',  '0', '- '. JText::_( 'Select a Category' ) .' -' );
                $categories = array_merge( $categories, $db->loadObjectList() );
        } else {
                $categories = $db->loadObjectList();
        }

        $category = JHTML::_('select.genericlist',   $categories, $name, 'class="inputbox" size="'. $size .'" '. $javascript, 'value', 'text', $active );
        return $category;
}

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

Examples[edit]

<CodeExamplesForm />