API15

JTableComponent/loadByOption: Difference between revisions

From Joomla! Documentation

m removing red link to edit, no existant pages
m preparing for archive only
 
Line 56: Line 56:


===Examples===
===Examples===
<CodeExamplesForm />
=== Code Examples ===
<dpl>
<dpl>
  noresultsheader=\n
  noresultsheader=\n
  category=loadByOption
  category=loadByOption
  category=JTableComponent
  category=JTableComponent
  category=CodeExample
  namespace=CodeExample
  category=MethodExample
  category=MethodExample
  include=*
  include=*

Latest revision as of 01:11, 25 March 2017

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

Code Examples