Welcome Guest, Not a member yet? Register   Sign In
Using a menu independently from specific controller
#2

[eluser]pistolPete[/eluser]
You can extend the Controller class:

Put a file named MY_Controller.php in /system/application/libraries with the following contents:

Code:
// choose a name for that controller subclass, e.g. "ApplicationController"
class ApplicationController extends Controller {
   function ApplicationController()
   {
        parent::Controller();
   }
    
   function drawMenu()
   {
       // build your menu here
   }
}

Now update all your existing Controllers:
Code:
class Main extends ApplicationController //instead of "extends Controller"
{
   function index()
   {
      [...]
      $this->drawContent();
      $this->drawMenu();
      $this->template->render();
   }
[...]
}


Messages In This Thread
Using a menu independently from specific controller - by El Forum - 10-28-2008, 06:09 AM
Using a menu independently from specific controller - by El Forum - 10-28-2008, 08:01 AM
Using a menu independently from specific controller - by El Forum - 10-28-2008, 08:12 AM
Using a menu independently from specific controller - by El Forum - 10-28-2008, 08:17 AM
Using a menu independently from specific controller - by El Forum - 10-28-2008, 10:10 AM



Theme © iAndrew 2016 - Forum software by © MyBB