2009年3月2日星期一

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

Thanks i already looked at those files. Still can i place an instance of the addRoute inside a certain controller? or do i need to place it somewhere in the bootstarp file? Basically what i would like to do is to make a file that will hold all the routes for each module/controller. Did anyone made something like that before?

Thanks.

On Mon, Mar 2, 2009 at 2:22 PM, Jens Kleikamp <jens@codes-concepts.com> wrote:
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.










--
Vincent Gabriel.
Lead Developer, Senior Support.
Zend Certified Engineer.




没有评论: