Support Joomla!

references:joomla.framework:application:jcontroller-_setpath

Table of Contents

_setPath

API Package Subpackage Class Method Reference Last reviewed Doc status
API Home Package Joomla.Framework Subpackage Application Class JController Method _setPath Reference _setPath() Never Work in Progress

Sets an entire array of search paths for resources.

The default directories are always added as a last resort for searches. The existing array is cleared, the default path is added and then the specified paths are added.

This method is protected and should only be invoked by methods of derived classes.

Syntax

void _setPath ( $type, $path )

$type string is a string containing the type of path to set, typically ‘view’ or ‘model’.
$path mixed is either a string containing the new path, or an array of strings containing the new paths to add.

Examples

Example

$viewPaths = array( '/var/www/trunk/administrator/components/com_weblinks/otherviews/',
					'/var/www/trunk/administrator/components/com_weblinks/moreviews/'
				  );
$controller = new JController();
print_r( $controller->_path );
$controller->_setPath( 'view', $viewPaths );
print_r( $controller->_path );

might produce (note that neither _addPath or _path should not be accessed directly and are only used here for demonstration purposes)

Result

Array
(
    [model] => Array
        (
            [0] => /var/www/trunk/administrator/components/com_weblinks/models/
        )

    [view] => Array
        (
            [0] => /var/www/trunk/administrator/components/com_weblinks/views/
        )

)
Array
(
    [model] => Array
        (
            [0] => /var/www/trunk/administrator/components/com_weblinks/models/
        )

    [view] => Array
        (
            [0] => /var/www/trunk/administrator/components/com_weblinks/moreviews/
            [1] => /var/www/trunk/administrator/components/com_weblinks/otherviews/
            [2] => /var/www/trunk/administrator/components/com_weblinks/views/
        )

)

 
references/joomla.framework/application/jcontroller-_setpath.txt (656 views) · Last modified: 2007/08/15 14:49