Actions

API16

JTable/addIncludePath

From Joomla! Documentation

< API16:JTable
Revision as of 17:41, 22 March 2010 by Doxiki (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
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

Add a filesystem path where JTable should search for table class files. You may either pass a string or an array of paths.

[Edit Descripton]

Description:JTable/addIncludePath

Syntax

static addIncludePath($path=null)
Parameter Name Default Value Description
$path null A filesystem path or array of filesystem paths to add.

Returns

array An array of filesystem paths to find classes in.

Defined in

libraries/joomla/database/table.php

Importing

jimport( 'joomla.database.table' );

Source Body

public static function addIncludePath($path = null)
{
        // Declare the internal paths as a static variable.
        static $_paths;
 
        // If the internal paths have not been initialised, do so with the base table path.
        if (!isset($_paths)) {
                $_paths = array(dirname(__FILE__).DS.'table');
        }
 
        // Convert the passed path(s) to add to an array.
        settype($path, 'array');
 
        // If we have new paths to add, do so.
        if (!empty($path) && !in_array($path, $_paths)) {
                // Check and add each individual new path.
                foreach ($path as $dir) {
                        // Sanitize path.
                        $dir = trim($dir);
 
                        // Add to the front of the list so that custom paths are searched first.
                        array_unshift($_paths, $dir);
                }
        }
 
        return $_paths;
}

[Edit See Also] SeeAlso:JTable/addIncludePath

Examples

<CodeExamplesForm />