API16

JAdapter/setAdapter

From Joomla! Documentation

< API16:JAdapter

The "API16" 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.

Description[edit]

Set an adapter by name


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

Syntax[edit]

setAdapter($name, &$adapter=null)
Parameter Name Default Value Description
$name $name Adapter name
&$adapter null $adapter Adapter object

Returns[edit]

boolean True if successful

Defined in[edit]

libraries/joomla/base/adapter.php

Importing[edit]

jimport( 'joomla.base.adapter' );

Source Body[edit]

public function setAdapter($name, &$adapter = null)
{
        if (!is_object($adapter))
        {
                // Try to load the adapter object
                require_once $this->_basepath.DS.$this->_adapterfolder.DS.strtolower($name).'.php';
                $class = $this->_classprefix.ucfirst($name);
                if (!class_exists($class)) {
                        return false;
                }
                $adapter = new $class($this, $this->_db);
        }
        $this->_adapters[$name] =& $adapter;
        return true;
}


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

Examples[edit]

Code Examples[edit]