I think so too. And Matt's post is very useful for me too.
I am eagerly waiting for 1.8.
regard.
2009/2/24 vadim gavrilov <vadimg88@gmail.com>:
> Thanks for detailed explanation of the way your doing it. One thing about
> goo practice i am trying to follow is "keeping things simple" if you know
> this is a tricky solution then it might not be the best way of doing it. 1.8
> as Matt stated has some new architecture that comes along with it that will
> probably (or should) make writing moduler application easier.
>
> Vince.
>
> On Tue, Feb 24, 2009 at 3:25 PM, Tomoaki Kosugi <kipspro@gmail.com> wrote:
>>
>> Thanks,
>>
>> The dispatcher::classToFilename replaces the '_' with a '/' in.
>> Thus the url chained by "_" is mapped to the controller in sub
>> directories.
>> If we use the urls rule as subdirectory-matching,
>> we must encounter an interpretation problem.
>>
>> Request:
>> /admin/tools/other/create
>> 1.longest match
>> controller = tools_other_create
>> action = default
>> 2.another match
>> controller = tooles_other
>> action = create
>>
>> I supporse ,the solution of this problem is to set up routes by hand.
>> Router_Route_Static can make a static routing.
>> And Router_Route_Regex can make a dynamic routing to sub directories.
>> These solutions have also an order of matching rules.
>> Actually, these are functionable.
>>
>> However, in case anyone needs an automatic routing to sub directories,
>> he must take the policy which rule to match.
>>
>> In my case,I have made a custom dispatcher that has these methods
>> dispatcher::isValidControllerPath($path, $module)
>> dispatcher::getModuleControllers($module)
>> And my My_Router_Route_Module::match() check if manually the path
>> exists in the module's directory. and check if
>> dispatcher::isValidControllerPath($path, $module)
>> # considering a performance, matched rule is cached.
>>
>> On another front, I have an idea of the router that determine the
>> directory like a RecursiveDirectoryIterator.
>> In this case, the router checks the path to match the first part and
>> trys to check the remains to match.
>> ("Router_Route_Chain::match($path, $partial = null) "'s $partial shuld
>> be to do that?)
>> But an impracticable dynamic-route-name prevent me from doing that.
>> By default router use the name it set in addRoute().
>> If I make a dynamic and recursive router, the name must be got with
>> ex. $route->getName() recursively.And name shuld be composit structure
>> like an array.
>> It is too tricky.
>>
>> Have you got any insights?
>>
>> Excuse me ,I am not good at English.
>> Thanks.
>>
>>
>> 2009/2/24 vadim gavrilov <vadimg88@gmail.com>:
>> > 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.
>> >
>> >
>> >
>> >
>> >
>>
>
>
>
> --
> Vincent Gabriel.
> Lead Developer, Senior Support.
> Zend Certified Engineer.
>
>
>
>
>
没有评论:
发表评论