Welcome Guest, Not a member yet? Register   Sign In
dynamic menu
#4

[eluser]xwero[/eluser]
Code:
// application/controllers/MY_Controller.php
class MY_Controller extends Controller
{
   function Frontend()
   {
      parent::Controller();
   }
}
// extending the MY_Controller class for more flexibility
class Frontend extends MY_Controller
{
   var $viewvars;

   function Frontend()
   {
      parent::MY_Controller();
      // build menu
      $this->viewvars['menu'] = $menu;
   }
}
Now all the controllers that extend the Frontend class will have the menu and you can add other variables too
Code:
class Home extend Frontend
{
   function index()
   {
       $this->viewvars['title'] = 'Welcome';
       $this->load->view('home/index',$this->viewvars);
   }
}


Messages In This Thread
dynamic menu - by El Forum - 09-11-2008, 09:20 AM
dynamic menu - by El Forum - 09-11-2008, 12:16 PM
dynamic menu - by El Forum - 09-12-2008, 02:44 AM
dynamic menu - by El Forum - 09-12-2008, 03:18 AM
dynamic menu - by El Forum - 09-12-2008, 09:35 AM
dynamic menu - by El Forum - 09-13-2008, 07:27 AM



Theme © iAndrew 2016 - Forum software by © MyBB