-1) ¿Como paso las variables de cada Método a la vista correspondiente?
-2) ¿Como paso los Argumentos? call_user_func([$cnt,$mtd],$args)
Gracias
portada_index.php
Código HTML:
 <?php print_r($args) ?> Código PHP:
   <?php
    class Controller{
        function __construct(){require_once('theme_header.phtml');
            $args = isset($_GET['url']) ? explode('/',$_GET['url']) : ['portada'];
            method_exists($cnt=array_shift($args),$mtd=empty($args)?'index':array_shift($args)) ? (new $cnt())->{$mtd}() : (new errors())->method();
        }
        function __destruct(){require_once('theme_footer.phtml');}
    }
    function view($cnt,$mtd){file_exists($file=$cnt.'_'.$mtd.'.phtml') ? require_once($file) : (new errors())->view();}
    class portada{
        function index(){view(__CLASS__,__FUNCTION__);}
    }
    class usuarios{
        function index(){view(__CLASS__,__FUNCTION__);}
    }
    class errors{
        function method(){echo __METHOD__;}
        function view(){echo __METHOD__;}
    }
    new Controller();    Código PHP:
       class Controller{
        function __construct(){require_once('theme_header.phtml');
            $args = isset($_GET['url']) ? explode('/',$_GET['url']) : ['portada'];
            method_exists($cnt=array_shift($args),$mtd=empty($args)?'index':array_shift($args)) ? (new $cnt())->{$mtd}() : (new errors())->method();
            $datos = call_user_func_array([$cnt,$mtd],$args);
        }
        function __destruct(){require_once('theme_footer.phtml');}
    } 
    
 

