API16

JPathway/getInstance

From Joomla! Documentation

< API16:JPathway

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]

Returns a JPathway object



Syntax[edit]

static getInstance($client, $options=array())
Parameter Name Default Value Description
$client $client The name of the client
$options array() $options An associative array of options

Returns[edit]

A pathway object. 

Defined in[edit]

libraries/joomla/application/pathway.php

Importing[edit]

jimport( 'joomla.application.pathway' );

Source Body[edit]

static function getInstance($client, $options = array())
{
        static $instances;

        if (!isset($instances)) {
                $instances = array();
        }

        if (empty($instances[$client]))
        {
                //Load the router object
                $info = &JApplicationHelper::getClientInfo($client, true);

                $path = $info->path.DS.'includes'.DS.'pathway.php';
                if (file_exists($path))
                {
                        require_once $path;

                        // Create a JPathway object
                        $classname = 'JPathway'.ucfirst($client);
                        $instance = new $classname($options);
                }
                else
                {
                        $error = JError::raiseError(500, 'Unable to load pathway: '.$client);
                        return $error;
                }

                $instances[$client] = & $instance;
        }

        return $instances[$client];
}



Examples[edit]

Code Examples[edit]