Welcome Guest, Not a member yet? Register   Sign In
How should this function be achieved using MVC
#2

[eluser]thurting[/eluser]
I'm not really sure what you are trying to accomplish, but your description sounds like it could be solved by creating a super class from which the relevant controllers inherit from. Just remember to call the parent constructor throughout the chain so Controller::Controller() is eventually called.
Code:
//This is the superclass all controllers must inherit from - core class
class Controller {}

//This should probably be an abstract class
abstract class EmailController extends Controller {
  public function __construct() {
    parent::Controller();
  }

  private function _mail() {
     //your function here
  }
}

//This is your action controller
class ActionController extends EmailController {
  public function __construct() {
    parent::__construct();
  }

  public function action() {
    //This is an action - I can call the _mail function from here
    $this->_mail();
  }
}


Messages In This Thread
How should this function be achieved using MVC - by El Forum - 01-24-2008, 10:52 PM
How should this function be achieved using MVC - by El Forum - 01-24-2008, 11:03 PM
How should this function be achieved using MVC - by El Forum - 01-24-2008, 11:15 PM
How should this function be achieved using MVC - by El Forum - 01-24-2008, 11:19 PM
How should this function be achieved using MVC - by El Forum - 01-24-2008, 11:39 PM
How should this function be achieved using MVC - by El Forum - 01-24-2008, 11:40 PM
How should this function be achieved using MVC - by El Forum - 01-24-2008, 11:46 PM
How should this function be achieved using MVC - by El Forum - 01-24-2008, 11:51 PM
How should this function be achieved using MVC - by El Forum - 01-24-2008, 11:59 PM
How should this function be achieved using MVC - by El Forum - 01-25-2008, 12:05 AM
How should this function be achieved using MVC - by El Forum - 01-25-2008, 12:12 AM
How should this function be achieved using MVC - by El Forum - 01-25-2008, 12:22 AM



Theme © iAndrew 2016 - Forum software by © MyBB