I am writing my multilevel navigation element(s), data coming from database. When I click menu item, I want to pass parameter to APP_CONTROLLER, which would do some magic for me.
How can I pass URL parameters to APP_CONTROLLER to have functionality, that would affect on all controllers?
URL: http://localhost/controller/function/id:5 or http://localhost/controller/function/5
If I try to fetch parameter(s) in APP_CONTROLLER like this
public function beforeFilter() {
$id = $this->params[‘id’];
} }
or
public function beforeFilter($id) {
some code
}}
I will get error messages like Undefined index… or Missing argument 1 for AppController::beforeFilter()…
I am pretty new to CakePHP, how this can be done? Or have I some fundamendal design flaw?
// Jari
The first option is better.
app_controller
view
And do not forget to add “parent::beforeFilter();” in within “beforeFilter” at other Controllers.
I hope you help.