Tuesday, March 20, 2012

Re: Problems with menu_builder

change your urls to something like this:

'url' => array('plugin' => null, 'controller' => 'rooms', 'action' => ''),


And links should stay without plugin prefix.

On Tuesday, March 20, 2012 10:40:41 AM UTC+1, Thomas wrote:
Now that I finally managed to get the menu builder helper plugin ( see https://github.com/torifat/cake-menu_builder) working I stumbled across the next problem.

I defined the following menu in the beforefilter of appcontroller.php:

        function beforeFilter() {

            // Define your menu
            $menu = array(
                'main-menu' => array(
                    array(
                        'title' => 'Management',
                        'url' => array('controller' => 'management', 'action' => 'view'),
                        'children' => array(
                            array(
                                'title' => 'Requests',
                                'url' => array('controller' => 'managerequests', 'action' => 'view'),
                            ),
                            array(
                                'title' => 'Rooms',
                                'url' => array('controller' => 'managerooms', 'action' => 'view'),
                            ),
                            array(
                                'title' => 'Mailing',
                                'url' => array('controller' => 'managemail', 'action' => 'view'),
                            ),
                        )
                    ),
                    array(
                        'title' => 'Reporting',
                        'url' => array('controller' => 'reporting', 'action' => 'view'),
                        'children' => array(
                            array(
                                'title' => 'Requests',
                                'url' => array('controller' => 'reportrequests', 'action' => 'view'),
                            ),
                            array(
                                'title' => 'Rooms',
                                'url' => array('controller' => 'reportrooms', 'action' => 'view'),
                            ),
                            array(
                                'title' => 'Billing',
                                'url' => array('controller' => 'billing', 'action' => 'view'),
                            ),
                        )
                    ),
                    array(
                        'title' => 'Administration',
                        'url' => array('controller' => 'administation', 'action' => 'view'),
                        'children' => array(
                            array(
                                'title' => 'Rooms',
                                'url' => array('controller' => 'rooms', 'action' => ''),
                            ),
                            array(
                                'title' => 'Catering',
                                'url' => array('controller' => 'admincatering', 'action' => 'view'),
                            ),
                            array(
                                'title' => 'Location',
                                'url' => array('controller' => 'adminlocation', 'action' => 'view'),
                            ),
                            array(
                                'title' => 'Email',
                                'url' => array('controller' => 'adminlocation', 'action' => 'view'),
                            ),
                            array(
                                   'title' => 'User management dashboard',
                                   'url' => '/dashboard',
                            ),
                        )
                    ),
                    array(
                        'title' => 'Logout',
                        'url' => '/logout',
                    ),       
                ),
            );

The menu shows up nicely, but when I go to the user management dashboard page, suddenly all menu entry links are prefixed with "usermin", which is the controller of the user management plugin.

So when I eg. try to go to the rooms management instead of calling localhost/cakephp/rooms, it calls localhost/cakephp/usermin/rooms, which does not exists -> "Error: Usermin.RoomsController could not be found."

Thomas

--
Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org
Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions.
 
 
To unsubscribe from this group, send email to
cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php

No comments: