class Profil_Controller extends Index_Controller { protected $id; protected $profil; public function __construct(){ parent::__construct(); $this->profil=new Profil_Model; $this->template->menu=new View('profil_menu'); } public function index($index){ url::redirect('index.php/index'); $this->id=$index; $this->template->menu->id=$index; $wynik=$this->profil->informacje($index); $this->template->content=new View('informacje'); $this->template->content->informacje=$wynik; $this->template->render(TRUE); } public function informacje(){ $id = ($this->id == $this->session->get('id')) ? $this->session->get('id') : $this->id; $wynik=$this->profil->informacje($id); $this->template->content=new View('informacje'); $this->template->content->informacje=$wynik; $this->template->render(TRUE); }
Przy wejściu do profilu użytkownika odpalam metodę index, i wszystko działa, gdy wybiorę w menu informacje, nie pojawiają się żadne informacje. Problemem jest to że nie wypisuje żadnej wartości $this->id.
W tym kontrolerze mam także inne metody: do zmiany hasła, swoich danych, uploadu avatara oraz ulubione. Nie jestem pewien czy dobrze to podzieliłem, czy nie porozbijać tego jakoś inaczej (dodatkowe kontrolery etc.)?