API15:JTableComponent/loadByOption
From Joomla! Documentation
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