Excellent, thanks. I ended up with something like:
$router->addRoute( 'adminTeachers',
new Zend_Controller_Router_Route('admin/teacher/:action', array(
'controller' => 'teacher', 'action' => 'index'))
);
If I want to have multiple routes, e.g. admin/teacher, admin/class
would I setup a similar route as above for each controller?
Also I'm playing with passing in parameters into the route, e.g.
admin/teachers/edit/1 I was able to get it to work by doing:
$router->addRoute( 'adminTeachers',
new Zend_Controller_Router_Route('admin/teacher/:action/:id',
array(
'controller' => 'teacher', 'action' => 'index'))
);
But if I just do something like: http://domain.com/admin/teacher/add I
get an "invalid controller specified "admin"". How do I have both
routes, or do I need to specify both specifically?
Mark
On Tue, Jan 26, 2010 at 12:04 PM, Hector Virgen <[email protected]> wrote:
> try setting your route to "admin/:action/*"
>
> --
> Hector
>
>
> On Tue, Jan 26, 2010 at 11:58 AM, Mark Steudel <[email protected]> wrote:
>>
>> Hi,
>>
>> I am trying to setup a custom router to create a "admin area" type of
>> thing:
>>
>> I've started with:
>>
>> $frontController = Zend_Controller_Front::getInstance();
>> $router = $frontController->getRouter();
>>
>> $router->addRoute( 'listTeachers',
>> new Zend_Controller_Router_Route('admin', array( 'controller' =>
>> 'teacher', 'action' => 'index'))
>> );
>>
>> Which works, when I go to http://domain.com/admin
>>
>> How do I create a sort of wild-card route so that I can access all of
>> the actions in the teacher controller?
>>
>> If I do http://domain.com/admin/teacher/add I get
>>
>> Invalid controller specified "admin"
>>
>> TIA, Mark
>
>
--
-----------------------------------------
Mark Steudel
P: 206.375.7244
[email protected]
. : Work : .
http://www.mindfulinteractive.com
. : Play : .
http://www.steudel.org/blog