List Info

Thread: extend router to understand areas?




extend router to understand areas?
user name
2006-07-30 07:16:37
Or I can also create UserController/AdminController as a
factory class
for creating subcontrollers (from user/ and admin/
directories
respectively), its cheat a bit, but could work. I didnt see
this
rewrite-router in work, maybe it could handle situations
like this?


On 30/07/06, Christopher Thompson <cxthompsoncharter.net> wrote:
> I have a proposal to allow Actions to be put in
sub-directories. I think
> there has been some work elsewhere to make this happen
as well. You
> could have URLs like user_signin/, admin_users/ that
would reference
> controllers in the user and admin directories within
the controller
> directory.
>
>
> Laszlo Horvath wrote:
> > Hi all,
> >
> > Problem: I have /, user/, admin/  main routes in
my system. For / the
> > current router is perfect, but I would like to
have directory layout
> > like:
> > /app
> >      /controller
> >                    /user/  (multiple user related
controllers in
> > directory)
> >                    /admin/  (multiple admin
related controllers in
> > directory)
> >                   IndexController.php and others
for public
> >
> > other parts would be much like default layout
> >
> > Reason: If user or admin area have big number of
actions, it will
> > become a very large and hardly maintanable piece
of code (and in such
> > areas there always is a lot of them).
> >
> > Solution??: I tried to implement
Zend_Controller_Router_Interface,
> > with a new router but I cant call
setControllerDirectory() from there,
> > its part of Front_Controller, which would solve my
problems and make
> > my objects instantiate correctly.
> >
> > How do you implement this? Dont mind about 1000+
lines in UserController?
> >
> > and a bit offtopic: I would make
setControllerDirectory() accept array
> > of directories.
> >
> > Thanks in advance for your ideas, suggestions
> >
>
extend router to understand areas?
user name
2006-07-30 13:24:13
I think you might just want two actions in your controller:
adminAction and userAction
Then put all your admin stuff in admin as parameters:
http://www.yoursite.com/blog/adminAction/subdir/fun/i
tem/7/
http://www.yoursite.com/blog/userAction/subdir2/ha
ppy/item/42/
Doesn't matter where your code is stored.
You can setup your paths in the adminAction and userAction
of the controller.

Derek
[1-2]

about | contact  Other archives ( Real Estate discussion Medical topics )