API15

API15:JHTML/addIncludePath

From Joomla! Documentation

Revision as of 22:18, 22 March 2010 by Doxiki (talk | contribs) (New page: ===Description=== Add a directory where JHTML should search for helpers. You may either pass a string or an array of directories. <span class="editsection" style="font-size:76%;"> <no...)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Description

Add a directory where JHTML should search for helpers. You may either pass a string or an array of directories.

[Edit Descripton]

Template:Description:JHTML/addIncludePath

Syntax

addIncludePath($path='')
Parameter Name Default Value Description
$path A path to search.

Returns

array An array with directory elements

Defined in

libraries/joomla/html/html.php

Importing

jimport( 'joomla.html.html' );

Source Body

function addIncludePath( $path='' )
{
        static $paths;

        if (!isset($paths)) {
                $paths = array( JPATH_LIBRARIES.DS.'joomla'.DS.'html'.DS.'html' );
        }

        // force path to array
        settype($path, 'array');

        // loop through the path directories
        foreach ($path as $dir)
        {
                if (!empty($dir) && !in_array($dir, $paths)) {
                        array_unshift($paths, JPath::clean( $dir ));
                }
        }

        return $paths;
}

[Edit See Also] Template:SeeAlso:JHTML/addIncludePath

Examples

<CodeExamplesForm />