Actions

API16

JTableAsset/loadByName

From Joomla! Documentation

< API16:JTableAsset
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

Method to load an asset by it's name.

[Edit Descripton]

Description:JTableAsset/loadByName

Syntax

loadByName($name)
Parameter Name Default Value Description
$name The name of the asset.

Returns

int

Defined in

libraries/joomla/database/table/asset.php

Importing

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

Source Body

public function loadByName($name)
{
        // Get the asset id for the asset.
        $this->_db->setQuery(
                'SELECT `id`' .
                ' FROM `#__assets`' .
                ' WHERE `name` = '.$this->_db->Quote($name)
        );
        $assetId = (int) $this->_db->loadResult();
 
        // Check for a database error.
        if ($error = $this->_db->getErrorMsg())
        {
                $this->setError($error);
                return false;
        }
 
        return $this->load($assetId);
}

[Edit See Also] SeeAlso:JTableAsset/loadByName

Examples

<CodeExamplesForm />