Jump to content

Multiple Controllers in one Module?


Recommended Posts

Can I have multiple controllers in the same module?

I have a module which sets up a new page for "Teams".  This module sets up a new menu item and loads the layout.  The URL is: index.php?controller=AdminTeams

 

I then took the main module file and added another menu item, "Colors".  I want this to load a different layout.  The link it generates in the URL is: index.php?controller=AdminColor

 

The Team page works great, but I an not seem to get the Color page to load a different layout.  Here is my code in the AdminTeamController.php

 

if ($_REQUEST['controller']=='AdminTeams') {
    $this->setTemplate('../../../../modules/lgs_teams/views/templates/admin/team.tpl'); 
} elseif ($_REQUEST['controller']=='AdminColor') {
    $this->setTemplate('../../../../modules/lgs_teams/views/templates/admin/team.tpl'); 
} else {
    $this->setTemplate('../../../../modules/lgs_teams/views/templates/admin/error.tpl'); 
}

 But I get a "Controller Not Found" error when clicking on the Color link (to show the page). I'm I doing this wrong someplace?

 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...