[eluser]Comanche[/eluser]
Hi there,
I just realized that all my controllers do nearly the sameaction, building a menu depending on URI parameters.
They don't do exaclty the same, since some controllers are sending different parameters (for example one controller uses 'letter', one uses 'sort' etc.) but all together they nearly do the same, changing the menu depending on different parameters.
So I was wondering if it is possible to build a menu-class (or something alike) which analyzes the URI parameters and does the correct output on it's own, so that it's independent from the controllers.
At the moment the whole thing is working the following way:
1. Controller is called with specific function
2. Controller executes function and gatheres needed information
3. Controller calls private function "drawContent()", which builds the main output
4. Controller calls private function "drawMenu()", which builds the menu depending on URI Parameters
5. Controller calls $this->template->render();
"drawContent" and "drawMenu" are private function of the controller, so every controller needs a "drawMenu"-function even though this function does the same for all controllers.
What I want to have is:
1. Controller is called with specific function
2. Controller executes function and gatheres needed information
3. Controller calls private function "drawContent()", which builds the main output
4. Controller calls the "global" function "drawMenu()", which builds the menu depending on URI Parameters
5. Controller calls $this->template->render();
The idea is that I don't have "thousands" of different menu functions which I have to take care of but just one function which can take care of all different states.
Greetings,
Comanche