Actions

API15

JTableComponent/loadByOption

From Joomla! Documentation

< API15:JTableComponent
Revision as of 13:53, 12 May 2013 by JoomlaWikiBot (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

Loads a data row by option

[<! removed edit link to red link >]

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

Syntax

loadByOption($option)
Parameter Name Default Value Description
$option The component option value

Returns

boolean

Defined in

libraries/joomla/database/table/component.php

Importing

jimport( 'joomla.database.table.component' );

Source Body

function loadByOption( $option )
{
        $db = &$this->getDBO();
        $query = 'SELECT id' .
                        ' FROM #__components' .
                        ' WHERE ' . $db->nameQuote( 'option' ) . '=' . $db->Quote( $option ) .
                        ' AND parent = 0';
        $db->setQuery( $query, 0, 1 );
        $id = $db->loadResult();
 
        if ($id === null) {
                return false;
        } else {
                return $this->load( $id );
        }
}

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

Examples

<CodeExamplesForm />