public function view($pathname = '', $data = false, $return = false) {

        if (is_array($data) || is_object($data)) {
            foreach ($data as $key => $value) {
                $$key = $value;
            }
        }

        // If no pathname specified, grab template name.
        if ($pathname == '') {
            $pathname = $this->config['template'];
        }

        $fullPath = $this->config['pathToViews'] .
                    $this->getPath($pathname);
        $path = $this->getPath($pathname);

        $this->debug('Full Path: '.$fullPath);

        $fileName = $this->config['viewsPrefix'] .
                    $this->getName($pathname) .
                    $this->config['viewsPostfix'] .
                    '.php';


        // Determine full filepath to View
        //$filePath = $fullPath . $fileName;

        $filePath = $this->_getFilePath($pathname, $fileName);

        // Debug
        $this->debug('');
        $this->debug( 'Searching for View: ');
        $this->debug( 'View Name: ' . $this->getName($pathname) );
        $this->debug( 'View Path: ' . $this->getPath($pathname) );
        $this->debug( 'File Path: ' . $filePath);
        $this->debug('');

        // Either return the view for storage in a variable, or output to browser.
        if ($return || $this->neverOutput) {
            ob_start();
            $inc = include($filePath);

            // If in dev mode and the include failed, throw an exception.
            if ($inc == false && $this->config['mode'] == 'development') { 
                throw new \Exception("Can't find file '$fileName' using path '$filePath'"); 
            }
            return ob_get_clean();
        }
        else {
            $inc = include($filePath);

            // If in dev mode and the include failed, throw an exception.
            if ($inc == false && $this->config['mode'] == 'development') { 
                throw new \Exception("Can't find file '$fileName' using path '$filePath'"); 
            }
        }
    }
public function view($pathname = '', $data = false, $return = false) {

        if (is_array($data) || is_object($data)) {
            foreach ($data as $key => $value) {
                $$key = $value;
            }
        }

        // If no pathname specified, grab template name.
        if ($pathname == '') {
            $pathname = $this->config['template'];
        }

        $fullPath = $this->config['pathToViews'] .
                    $this->getPath($pathname);
        $path = $this->getPath($pathname);

        $this->debug('Full Path: '.$fullPath);

        $fileName = $this->config['viewsPrefix'] .
                    $this->getName($pathname) .
                    $this->config['viewsPostfix'] .
                    '.php';


        // Determine full filepath to View
        //$filePath = $fullPath . $fileName;

        $filePath = $this->_getFilePath($pathname, $fileName);

        // Debug
        $this->debug('');
        $this->debug( 'Searching for View: ');
        $this->debug( 'View Name: ' . $this->getName($pathname) );
        $this->debug( 'View Path: ' . $this->getPath($pathname) );
        $this->debug( 'File Path: ' . $filePath);
        $this->debug('');

        // Either return the view for storage in a variable, or output to browser.
        if ($return || $this->neverOutput) {
            ob_start();
            $inc = include($filePath);

            // If in dev mode and the include failed, throw an exception.
            if ($inc == false && $this->config['mode'] == 'development') { 
                throw new \Exception("Can't find file '$fileName' using path '$filePath'"); 
            }
            return ob_get_clean();
        }
        else {
            $inc = include($filePath);

            // If in dev mode and the include failed, throw an exception.
            if ($inc == false && $this->config['mode'] == 'development') { 
                throw new \Exception("Can't find file '$fileName' using path '$filePath'"); 
            }
        }
    }
public function view ( $ pathname = '' , $ data = false , $ return = false ) { if ( is_array ( $ data ) || is_object ( $ data ) ) { foreach ( $ data as $ key => $ value ) { $ $ key = $ value ; } } // If no pathname specified, grab template name. if ( $ pathname == '' ) { $ pathname = $ this -> config [ 'template' ] ; } $ fullPath = $ this -> config [ 'pathToViews' ] . $ this -> getPath ( $ pathname ) ; $ path = $ this -> getPath ( $ pathname ) ; $ this -> debug ( 'Full Path: ' . $ fullPath ) ; $ fileName = $ this -> config [ 'viewsPrefix' ] . $ this -> getName ( $ pathname ) . $ this -> config [ 'viewsPostfix' ] . '.php' ; // Determine full filepath to View //$filePath = $fullPath . $fileName; $ filePath = $ this -> _getFilePath ( $ pathname , $ fileName ) ; // Debug $ this -> debug ( '' ) ; $ this -> debug ( 'Searching for View: ' ) ; $ this -> debug ( 'View Name: ' . $ this -> getName ( $ pathname ) ) ; $ this -> debug ( 'View Path: ' . $ this -> getPath ( $ pathname ) ) ; $ this -> debug ( 'File Path: ' . $ filePath ) ; $ this -> debug ( '' ) ; // Either return the view for storage in a variable, or output to browser. if ( $ return || $ this -> neverOutput ) { ob_start ( ) ; $ inc = include ( $ filePath ) ; // If in dev mode and the include failed, throw an exception. if ( $ inc == false && $ this -> config [ 'mode' ] == 'development' ) { throw new \ Exception ( "Can't find file '$fileName' using path '$filePath'" ) ; } return ob_get_clean ( ) ; } else { $ inc = include ( $ filePath ) ; // If in dev mode and the include failed, throw an exception. if ( $ inc == false && $ this -> config [ 'mode' ] == 'development' ) { throw new \ Exception ( "Can't find file '$fileName' using path '$filePath'" ) ; } } }
Load view OR return view depending on 2nd parameter.
Load view OR return view depending on 2nd parameter .