Forum Moderators: coopster

Message Too Old, No Replies

writing an effective router/dispatcher for mvc pattern?

         

PHPycho

9:50 am on Jan 24, 2008 (gmt 0)

10+ Year Member



hello forums!
I am trying to make an router/dispatcher for oo mvc pattern.
I would like to have one default router pattern ie controller/method/id and other is customized one
for example
[PHP]http://example.com/controller/method/id/params => $controller->method($id[, $params])(general)
http://example.com/admin/controller/method/id/params => $controller->admin_method($id[, $params]) (customized)[/PHP]

Can anybody provide good suggestions/samples in dispatching such method.
Note: dispatching method should work both for url rewriting turned on or off by changing some flags.

Thanks in advance for your valueable suggestions.

[edited by: eelixduppy at 3:29 pm (utc) on Jan. 24, 2008]

phnord

9:19 pm on Jan 24, 2008 (gmt 0)

10+ Year Member



If you are looking to use the MVC design pattern in your PHP web applications, there are many good MVC frameworks that already exist. I personally like CodeIgniter. If you are just looking for good examples of what you are trying to do, then again, download a framework like CodeIgniter and look at the source code. CodeIgniter is pretty well built under the hood.

PHPycho

11:19 am on Jan 25, 2008 (gmt 0)

10+ Year Member



Knock Knock... Can anybody come with better ideas

phnord

3:16 pm on Jan 25, 2008 (gmt 0)

10+ Year Member



You said you were looking for examples and I just gave you one. Lots of the frameworks do already what you are trying to do...look at how they do it and learn.

No one is going to write code for you.