Hi everybody,
I would like to ask somebody kindly to help me with following issue with my CakePHP 4.2.4 app.
I created a simple web app - a register of subjects authorised to perform some activities. My app is based on several tables, like e.g. Subjects, People, Certificates, Workplaces, Menus …
I would like to make an element that would serve as side menu. This side menu shoud be generated automaticaly using the table Menus, which contains these data:
Menus (id,link name, controller, action, date of creation, date of change)
I baked simple actions like add, view edit links and everything works as it should. I modified /myapp/Menus/index.php into file sidemenu.php (and added corresponding action into MenusController.php) that show a list of working links.
public function sidemenu()
{
$menus = $this->paginate($this->Menus);
$this->set(compact('menus'));
}
When I copy sidemenu.php into file into /myapp/templates/element folder, and then incorporate element sidemenu.php into layout file default.php ($this->element(‘helpbox’)), it stops working.
The problem is that variable $menus is empty. Is there a way how to load table content into variable $menus in my element automatically?
Thank you very much!