Support Joomla!

references:joomla.framework:application:jcontroller-addviewpath

Table of Contents

addViewPath

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

Adds to the stack of controller view paths in LIFO order.

This method will invoke the protected JController::_addPath() method to add to the list of directories which are searched for views.

Syntax

void addViewPath ( $path )

$path mixed is either a string containing the directory to add, or an array of strings containing a list of directories to add to the view search path.

Examples

Example

jimport( 'joomla.application.component.controller' );

$controller = new JController();
print_r( $controller->_path );
$controller->addViewPath( JPATH_COMPONENT .DS. 'otherviews' );
print_r( $controller->_path );

might produce (note that the _path property is private and should not be used by third party applications. It is used here only for demonstration purposes)

Result

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

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

)

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

    [view] => Array
        (
            [0] => /var/www/trunk/components/com_prodigo/otherviews/
            [1] => /var/www/trunk/components/com_prodigo/views/
        )

)

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