I have a two classes PHP:
At Publicprofile
class there are:
public function index($id){
$profile = new profile($id, true);
$profile->index();
}
So, here I create a new object profile.
Let's some to see class Profile:
class Profile extends Auth {
public $data = array();
public function __construct($idUser = null, $view = false){
parent::__construct();
$this->getTemplate();
}
}
}
The function getTemplate(); - forms an array $this->data
If to show at once this array after execute getTemplate(), will see (via var_dump), that array contains data with a keys:
When is called a method $profile->index()
- this array not is same:
Method index in class Profile:
public function index(){
var_dump($this->data); die(); // Here there are not keys view_inside, view
$this->route();
}
What is wrong at my code, that the source array in one class is different at two methods?
Function GetTemplate():
public function getTemplate(){
$this->data['view_inside'] = 'profile/doctor/index';
$this->data['view_left'] = 'profile/doctor/left';
$this->data['view_edit'] = 'profile/doctor/personal_update';
$this->data['view_personal'] = 'users/doctor/personal';
var_dump($this->data); // All right
}