Design patterns
Moderator: General Moderators
Hockey - re: Navigation problems with controllers.
I've found it easier to maintain navigation links with controllers than I have with seperate pages for the different actions.
I have a 'menu module' that dynamically collects and creates the menu items (navigation) based on the users access privileges. The info is stored in an array of page information in the format of(action being the keyword to use in the url generation - which is handled by another module)
This array can be static - i.e. in a config file, or generated from a DB table. (Flexibility has been my buzzword for the past month or so
)
The menu module is passed the above array for the pages, and the user object, then iterates through comparing the permissions of the user, and the permissions of the page/action in the array. If they have the right access, then it is added to the menu and so forth.
I've found it easier to maintain navigation links with controllers than I have with seperate pages for the different actions.
I have a 'menu module' that dynamically collects and creates the menu items (navigation) based on the users access privileges. The info is stored in an array of page information in the format of
Code: Select all
$PAGES = array(
array('page' => '<pagename>', 'permission' => 0, 'action' => '<pageaction>');
);This array can be static - i.e. in a config file, or generated from a DB table. (Flexibility has been my buzzword for the past month or so
The menu module is passed the above array for the pages, and the user object, then iterates through comparing the permissions of the user, and the permissions of the page/action in the array. If they have the right access, then it is added to the menu and so forth.
-
alex.barylski
- DevNet Evangelist
- Posts: 6267
- Joined: Tue Dec 21, 2004 5:00 pm
- Location: Winnipeg
That's the distinction I've been missing...and why I was refering to them as page controllers...I wish you realized that earlier...instead of making me write these long replies you could have said that right off the hop and I would have got it...The thing that Front Controllers and Page Controllers share is what Fowler calls an Input Controller -- Actions do not contain the Input Controller part
Cheers