API15

Difference between revisions of "JElementCategory/fetchElement"

From Joomla! Documentation

< API15:JElementCategory
m (removing red link to edit, no existant pages)
Line 1: Line 1:
 
 
<span class="editsection" style="font-size:76%;">
 
<span class="editsection" style="font-size:76%;">
<nowiki>[</nowiki>[[Description:JElementCategory/fetchElement|Edit Descripton]]<nowiki>]</nowiki>
+
<nowiki>[<! removed edit link to red link >]</nowiki>
 
</span>
 
</span>
  
{{Description:JElementCategory/fetchElement}}
+
<! removed transcluded page call, red link never existed >
  
 
===Syntax===
 
===Syntax===
Line 81: Line 80:
  
 
<span class="editsection" style="font-size:76%;">
 
<span class="editsection" style="font-size:76%;">
<nowiki>[</nowiki>[[SeeAlso:JElementCategory/fetchElement|Edit See Also]]<nowiki>]</nowiki>
+
<nowiki>[<! removed edit link to red link >]</nowiki>
 
</span>
 
</span>
{{SeeAlso:JElementCategory/fetchElement}}
+
<! removed transcluded page call, red link never existed >
  
 
===Examples===
 
===Examples===
Line 96: Line 95:
 
  format= ,,,
 
  format= ,,,
 
</dpl>
 
</dpl>
 +
[[Category:Archived pages API15]]

Revision as of 11:47, 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.

[<! removed edit link to red link >]

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

Syntax[edit]

fetchElement($name, $value, &$node, $control_name)
Parameter Name Default Value Description
$name
$value
&$node
$control_name

Defined in[edit]

libraries/joomla/html/parameter/element/category.php

Importing[edit]

jimport( 'joomla.html.parameter.element.category' );

Source Body[edit]

function fetchElement($name, $value, &$node, $control_name)
{
        $db = &JFactory::getDBO();

        $section        = $node->attributes('section');
        $class          = $node->attributes('class');
        if (!$class) {
                $class = "inputbox";
        }

        if (!isset ($section)) {
                // alias for section
                $section = $node->attributes('scope');
                if (!isset ($section)) {
                        $section = 'content';
                }
        }

        if ($section == 'content') {
                // This might get a conflict with the dynamic translation - TODO: search for better solution
                $query = 'SELECT c.id, CONCAT_WS( "/",s.title, c.title ) AS title' .
                        ' FROM #__categories AS c' .
                        ' LEFT JOIN #__sections AS s ON s.id=c.section' .
                        ' WHERE c.published = 1' .
                        ' AND s.scope = '.$db->Quote($section).
                        ' ORDER BY s.title, c.title';
        } else {
                $query = 'SELECT c.id, c.title' .
                        ' FROM #__categories AS c' .
                        ' WHERE c.published = 1' .
                        ' AND c.section = '.$db->Quote($section).
                        ' ORDER BY c.title';
        }
        $db->setQuery($query);
        $options = $db->loadObjectList();
        array_unshift($options, JHTML::_('select.option', '0', '- '.JText::_('Select Category').' -', 'id', 'title'));

        return JHTML::_('select.genericlist',  $options, ''.$control_name.'['.$name.']', 'class="'.$class.'"', 'id', 'title', $value, $control_name.$name );
}

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

Examples[edit]

<CodeExamplesForm />