So I\'m writing a framework on which I want to base a few apps that I\'m working on (the framework is there so I have an environment to work with, and a system that will let
Zend's MVC framework by default uses a structure like
/router/controller/action/key1/value1/key2/value2
where router
is the router file (mapped via mod_rewrite
, controller
is from a controller action handler which is defined by a class that derives from Zend_Controller_Action
and action
references a method in the controller, named actionAction
. The key/value pairs can go in any order and are available to the action method as an associative array.
I've used something similar in the past in my own code, and so far it's worked fairly well.
I think a lot of frameworks use a combination of Apache's mod_rewrite and a front controller. With mod_rewrite, you can turn a URL like this: /people/get/3 into this: index.php?controller=people&method=get&id=3. Index.php would implement your front controller which routes the page request based on the parameters given.