Destramic Posted February 14, 2011 Share Posted February 14, 2011 hey guys im making my own framework after messing about with a few and just wanted to ask what the dispatchers duties are altogther? 1. break down ulr to generate module/controller/action/parameters 2. load module? and 3. send module/controller/action/parameters to request class if someone could help me out with this question it would be great....thanks Quote Link to comment https://forums.phpfreaks.com/topic/227657-framework-dispacther-duties-question/ Share on other sites More sharing options...
lastkarrde Posted February 15, 2011 Share Posted February 15, 2011 Well it all depends on how you design your framework. That is one way to do it. My frameworks dispatch class accepts an instance of a Request object (holds information like $_GET, $_POST and the URI) and a list of URL routes. It then tries to match the URI to the routes, if a match is found it loads and calls the appropriate controller method (which returns an instance of a Response object). Finally it calls the output method on the instance of the Response object. Search github for php framework, look how other people have implemented theirs. Quote Link to comment https://forums.phpfreaks.com/topic/227657-framework-dispacther-duties-question/#findComment-1174403 Share on other sites More sharing options...
Destramic Posted February 15, 2011 Author Share Posted February 15, 2011 Thanks alot for your help...also is the controller and action loaded in the dispatch class?...thanks again Quote Link to comment https://forums.phpfreaks.com/topic/227657-framework-dispacther-duties-question/#findComment-1174480 Share on other sites More sharing options...
lastkarrde Posted February 15, 2011 Share Posted February 15, 2011 It is in my framework, yes. Quote Link to comment https://forums.phpfreaks.com/topic/227657-framework-dispacther-duties-question/#findComment-1174638 Share on other sites More sharing options...
Destramic Posted February 18, 2011 Author Share Posted February 18, 2011 you've been a great help...thanks guys just one more thing though when people describe thier url as /module/controller/action isn't it actually controller/action...i dont understand what the module is...if you could help to explain please thanks again Quote Link to comment https://forums.phpfreaks.com/topic/227657-framework-dispacther-duties-question/#findComment-1176487 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.