src/Common/CodeIgniter/Core/Loader.php
public function view($view, $vars = [], $return = false)
    {
        if (strpos($view, '/') === 0) {

            //  The supplied view is an absolute path, so use it.

            //  Add on EXT if it's not there (so pathinfo() works as expected)
            if (substr($view, strlen(EXT) * -1) != EXT) {
                $view .= EXT;
            }

            //  Get path information about the view
            $pathInfo = pathinfo($view);
            $path     = $pathInfo['dirname'] . '/';
            $view     = $pathInfo['filename'];

            //  Set the view path so the loader knows where to look
            $this->_ci_view_paths = [$path => true] + $this->_ci_view_paths;

            //  Load the view
            return $this->_ci_load([
                '_ci_view'   => $view,
                '_ci_vars'   => $this->_ci_object_to_array($vars),
                '_ci_return' => $return,
            ]);

        } else {

            /**
             * Try looking in the application folder second - prevents Nails views
             * being loaded over an application view.
             */

            $absoluteView = APPPATH . 'views/' . $view;

            if (substr($absoluteView, strlen(EXT) * -1) != EXT) {

                $absoluteView .= EXT;
            }

            if (file_exists($absoluteView)) {

                //  Try again with this view
                return $this->view($absoluteView, $vars, $return);

            } else {

                //  Fall back to the old method
                return parent::view($view, $vars, $return);
            }
        }
    }
public function view($view, $vars = [], $return = false)
    {
        if (strpos($view, '/') === 0) {

            //  The supplied view is an absolute path, so use it.

            //  Add on EXT if it's not there (so pathinfo() works as expected)
            if (substr($view, strlen(EXT) * -1) != EXT) {
                $view .= EXT;
            }

            //  Get path information about the view
            $pathInfo = pathinfo($view);
            $path     = $pathInfo['dirname'] . '/';
            $view     = $pathInfo['filename'];

            //  Set the view path so the loader knows where to look
            $this->_ci_view_paths = [$path => true] + $this->_ci_view_paths;

            //  Load the view
            return $this->_ci_load([
                '_ci_view'   => $view,
                '_ci_vars'   => $this->_ci_object_to_array($vars),
                '_ci_return' => $return,
            ]);

        } else {

            /**
             * Try looking in the application folder second - prevents Nails views
             * being loaded over an application view.
             */

            $absoluteView = APPPATH . 'views/' . $view;

            if (substr($absoluteView, strlen(EXT) * -1) != EXT) {

                $absoluteView .= EXT;
            }

            if (file_exists($absoluteView)) {

                //  Try again with this view
                return $this->view($absoluteView, $vars, $return);

            } else {

                //  Fall back to the old method
                return parent::view($view, $vars, $return);
            }
        }
    }
public function view ( $ view , $ vars = [ ] , $ return = false ) { if ( strpos ( $ view , '/' ) === 0 ) { //  The supplied view is an absolute path, so use it.
 //  Add on EXT if it's not there (so pathinfo() works as expected)
 if ( substr ( $ view , strlen ( EXT ) * - 1 ) != EXT ) { $ view .= EXT ; } //  Get path information about the view
 $ pathInfo = pathinfo ( $ view ) ; $ path = $ pathInfo [ 'dirname' ] . '/' ; $ view = $ pathInfo [ 'filename' ] ; //  Set the view path so the loader knows where to look
 $ this -> _ci_view_paths = [ $ path => true ] + $ this -> _ci_view_paths ; //  Load the view
 return $ this -> _ci_load ( [ '_ci_view' => $ view , '_ci_vars' => $ this -> _ci_object_to_array ( $ vars ) , '_ci_return' => $ return , ] ) ; } else { /**
             * Try looking in the application folder second - prevents Nails views
             * being loaded over an application view.
             */ $ absoluteView = APPPATH . 'views/' . $ view ; if ( substr ( $ absoluteView , strlen ( EXT ) * - 1 ) != EXT ) { $ absoluteView .= EXT ; } if ( file_exists ( $ absoluteView ) ) { //  Try again with this view
 return $ this -> view ( $ absoluteView , $ vars , $ return ) ; } else { //  Fall back to the old method
 return parent :: view ( $ view , $ vars , $ return ) ; } } }
Loads a view. If an absolute path is provided then that view will be used,
otherwise the system will search the modules

@param  string  $view   The view to load
@param  array   $vars   An array of data to pass to the view
@param  boolean $return Whether or not to return then view, or output it

@return mixed
Loads a view . If an absolute path is provided then that view will be used otherwise the system will search the modules