I've been working on a mapping sceme for urls to controllers and actions. At this point it works fine. I don't know if I've every seen anyone doing it quite like this so I wanted to get some feedback.
Would get a controller called ShopCartController inside of the controller directory like:
Then the ShopCartController::add() action is called. The id parameter is available in the request object, which is passed to the action method.
Would get a controller called DefaultController, because the about controller does not exist, and the default controller has an action called about().
This would call the AdminProductController (controllers/admin/product.php) and call it's edit() action. "id" is available as a parameter in the request object.
Basically, my URL parser starts at the begining of the path and iterates through each value checking to see if it is a valid controller OR folder OR action
If it finds a value that is NOT a controller, it checks to see if the last found controller (or default controller if no previous) in the path has an action matching the current path fragment. If it does, the remaining path is paired into parameters. If not, the path from that point is paired into parameters and the default action is called.
So, if the ShopCartController didn't exist, the ShopController::default() action would be called. At that point, "add" would be a key with a value of "is" and "43" would be a key with no value.
This all sounds confusing, but it actually works very nicely. If you (anyone) is interested, I'd be happy to post the code so you can see how it works.
I'm just curious to see what people think of this, and ultimately maybe get some feedback on the code I have.