Código:
  
application\View.phpFatal error: Using $this when not in object context in C:\xampp\htdocs\prueba\controllers\indexController.php on line 16
Código PHP:
       /*LLAMA-VISTA*/
    class View {
        private $_controlador;
 
        public function __construct(Request $peticion) {$this->_controlador = $peticion->getControlador();}
 
        public function renderizar($vista, $item = false) {
            /*
            $menu = array(
                array('id' => 'inicio', 'titulo' => 'inicio', 'enlace' => BASE_URL)
            );
            */
            /*
            $_layoutParams = array(
                'ruta_img' => BASE_URL.'views/layout/'.DEFAULT_LAYOUT.'/img/',
                'ruta_css' => BASE_URL.'views/layout/'.DEFAULT_LAYOUT.'/css/',
                'ruta_js'  => BASE_URL.'views/layout/'.DEFAULT_LAYOUT.'/js/' ,
                'menu'     => $menu
            );
            */
            $rutaView = ROOT.'views'.DS.$this->_controlador.DS.$vista.'.phtml'; //Ruta de la Vista pedida
        
            if (is_readable($rutaView)) { //Comprobamos que exista y sea legible la Vista
                //include_once ROOT.'views/layout'.DS.DEFAULT_LAYOUT.DS.'header.php';
                include_once $rutaView;
                //include_once ROOT.'views/layout'.DS.DEFAULT_LAYOUT.DS.'footer.php';
            } else {
                throw new Exception('No existe la Vista: ');
            }
        }
    } 
    Código PHP:
       /*CONTROLADOR-PRIMARIO*/
    class indexController extends Controller {
 
        /*CARGAMOS-OBJ-VIEW*/
        public function __construct() {
            parent::__construct();
        }
        /*CARGAMOS-OBJ-VIEW*/
            
        public function index() {
            $objRequest = new Request();
            echo "Estamos en el Controlador: 'controllers/".$objRequest->getControlador()."Controller.php'";
            /*CARGAMOS-OBJ-VIEW*/
            //$this->_view->titulo = 'Portada';
            $this->_view->renderizar('index');
            /*CARGAMOS-OBJ-VIEW*/
        }
    } 
    Código PHP:
       /*CONTROLADOR-PADRE*/
    abstract class Controller {
        
        /*CARGAMOS-OBJ-VIEW*/
        protected $_view;
        public function __construct() {$this->_view = new View(new Request);}
        /*CARGAMOS-OBJ-VIEW*/
        
        abstract public function index();
    } 
    Código PHP:
       /*LLAMA-CONTROLADORES-METODOS*/
    class Bootstrap {
        public function run(Request $peticion) { //Recogemos Controlador/Metodo/Argumentos de application/Request.php
            $controlador = $peticion->getControlador().'Controller'; //Controlador pedido
            $rutaControlador = ROOT.'controllers'.DS.$controlador.'.php'; //Ruta del Controlador pedido
            $metodo = $peticion->getMetodo(); //Metodo pedido
            $args = $peticion->getArgs(); //Argumentos pedidos
 
            if (is_readable($rutaControlador)) { //Comprobamos que exista y sea legible el Controlador
                require_once $rutaControlador; //Cargamos el controlador
                if (is_callable(array($controlador, $metodo))) { //Verifica que los contenidos de una variable puedan ser llamados como una función
                    $metodo = $peticion->getMetodo(); //Devolvemos el Metodo pedido
                } else {
                    $metodo = 'index'; //Devolvemos el Metodo por defecto
                }
 
                if (isset($args)) { //Comprobamos que existan los Argumentos
                    // Llamar una función de usuario dada con una matriz de parámetros
                    call_user_func_array(array($controlador, $metodo), $args);
                } else {
                    //Llamar a una llamada de retorno dada por el primer parámetro
                    call_user_func(array($controlador, $medoto));
                }
            } else {
                //Informamos que no existe la Ruta del Controlador
                throw new Exception('No existe el Controlador: \'controllers/'.$controlador.'.php\'');
            }
        }
    } 
    Código PHP:
       /*PROCESA-PETICIONES*/
    class Request {
        private $_controlador, $_metodo, $_argumentos;
        public function __construct() {
            if (isset($_GET['url'])) { //Comprobamos la recepcion de GET
                $url = filter_input(INPUT_GET, 'url', FILTER_SANITIZE_URL); //Filtramos GET por caracteres 'url' permitidos
                $url = explode('/', $url); //Convertimos GET en ARRAY
                $url = array_filter($url); //Eliminamos '/' sobrantes
 
                $this->_controlador = strtolower(array_shift($url)); //Extraemos controlador en minusculas
                $this->_metodo = strtolower(array_shift($url)); //Extraemos metodo en minusculas
                $this->_argumentos = $url; //Guardamos el ARRAY de los parametros
            }
            if (!$this->_controlador) $this->_controlador = DEFAULT_CONTROLLER; //Controlador
            if (!$this->_metodo) $this->_metodo = 'index'; //Metodo
            if (!$this->_argumentos) $this->_argumentos = array(); //Argumentos
        }
        public function getControlador() {return $this->_controlador;} //Externaliza el Controlador
        public function getMetodo() {return $this->_metodo;} //Externaliza el Metodo
        public function getArgs() {return $this->_argumentos;} //Externaliza los Argumentos
    } 
    Código PHP:
       /*CONSTANTES-RUTAS*/
    define('DS', DIRECTORY_SEPARATOR);
    define('ROOT', realpath(dirname(__FILE__)).DS);
    define('APP_PATH', ROOT.'application'.DS);
    
    /*ARCHIVOS-SISTEMA*/
    require_once APP_PATH.'Config.php'; /*PRUEBA_REQUEST*/
    require_once APP_PATH.'Request.php'; /*PRUEBA_REQUEST*/
    require_once APP_PATH.'Bootstrap.php'; /*PRUEBA_REQUEST*//*PRUEBA_BOOTSTRAP*/
    require_once APP_PATH.'Controller.php'; /*PRUEBA_REQUEST*//*PRUEBA_BOOTSTRAP*/
    require_once APP_PATH.'View.php';
 
    /*PRUEBA-REQUEST*/
    /*
    $objRequest = new Request();
    echo $objRequest->getControlador().'<br>';
    echo $objRequest->getMetodo().'<br>';
    print_r($objRequest->getArgs());
    echo "<br><br>";
    */
 
    /*PRUEBA-BOOTSTRAP*/
    try {
        Bootstrap::run(new Request);
    } catch (Exception $e) {
        echo $e->getMessage();
    } 
    
 

