Código PHP:
$init = new Controller();
$init->load->get('clase1.php');
$init->page = new Clase1;
// Aca accedo perfecto a la variable
echo $init->page->var;
$init->model->render($fileLoad[0]);
class Controller {
public $load;
public $model;
function __construct() {
$this->init();
}
function init(){
$this->load = new Load();
$this->model = new Model();
}
}
class Load{
function __construct() {
}
public function get($name)
{
require $name;
}
}
class Model{
function __construct() {
}
public function render($name,$noInclude = false)
{
// Aca no logro acceder a la variable
echo $init->page->var;
if ($noInclude == true) {
require 'views/' . $name;
}
else {
require 'head.php';
require 'views/' . $name;
require 'foot.php';
}
}
}
class Clase1 extends Controller {
function __construct() {
$this->varr();
}
function varr() {
$this->var = "Algo!";
}
}