2009年2月23日星期一

Re: [fw-mvc] modulear application with router for each controller in each application

Thanks,

I assume the '_' is what sets it to know it's a sub directory. Is there a way to replace the '_' with a '/' so the link will be admin/tools/other/[actionname] i know i can do this with the dispatcher but not sure how.

The thing i want to do with the router is have a file called router.php inside every controllers sub directory that will add routes to certain places. I didn't quite grasp the way i need to use the router class and from reading the documentation (what i read so far) it doesn't clearly say where you need to define the new instance of the router class. If it's in the bootstartup.php file then how can i access it later from each and every controller? I can't create a new instance in every controller beacuse that will be a bad design practice. How about creating a master controller that will extend the zend abstract and that one will create the instance of the router? Then i could just extend the master controller in every controller i have in my controllers directory? Is this something usable?

Thanks.

On Tue, Feb 24, 2009 at 1:36 AM, Tomoaki Kosugi <kipspro@gmail.com> wrote:
Hi

This is my guess,you need to set up two as below.

1. Controller Setup
2. Router Setup

1. Using action controllers in sub directories
/admin/tools/otherController.php
is mapped to below↓
className:
 Admin_Tools_OtherController
you can access this controller in this uri.
 /admin/tools_other/[actionname]/*

2.Router Setup
you can add routes from the uri  "/admin/tools/other"
 to the controller  named "tools_other" .

Excuse me ,I am not good at English.

regards

--
noopable:
Tomoaki Kosugi


2009/2/24 vince. <vadimg88@gmail.com>:
>
> How can i set a rewrite rule class/instance across the entire application
> that i could use sub directories inside the main controllers directory for
> each module? Meaning so i could have this structure:
>
> /application
>  /modules
>  /admin
>   /controllers
>    /index
>     /indexcontroller.php
>     /othercontroller.php
>    /tools
>     /indexcontroller.php
>     /othercontroller.php
>    /settings
>     /indexcontroller.php
>     /othercontroller.php
>   /layouts
>  /site
>   /controllers
>    /index
>     /indexcontroller.php
>     /othercontroller.php
>    /tools
>     /indexcontroller.php
>     /othercontroller.php
>    /settings
>     /indexcontroller.php
>     /othercontroller.php
>   /layouts
> /library
>
>
> and i could enter the file admin/controller/tools/other as follows:
> admin/tools/other trough the url. and basically use sub directories inside
> the controllers directory. what do i need to setup?
>
> Thanks.
>




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




没有评论: