2009年3月2日星期一

[fw-mvc] Re: Using custom router. Where exactly?

vadim gavrilov wrote:
> Where exactly do you place the router? In the bootstrap file? in the index?
> How can you make a custom router for each module you have? Examples will be
> highly appreciated.
>
You can take a look at Matthews Pastebin application. He uses a modular
directory structure and each module has its own bootstrap class. In
these classes you have access to the Initialize plugin and the
frontcontroller instance.

http://github.com/weierophinney/pastebin/blob/b796ad0e5905e46b312a5b904a2a80c3ed8ff808/library/My/Plugin/Initialize.php
http://github.com/weierophinney/pastebin/blob/b796ad0e5905e46b312a5b904a2a80c3ed8ff808/application/modules/spindle/Bootstrap.php

Now you can use the getRouter() method of the frontcontroller and then
add new custom routes with addRoute().


Hope this helps.

没有评论: