Thanks,

That's a very good starting point.  The one thing that I'm unsure of is how
to keep "products/list" different between the main site and the admin area. 
For example, /products/list should show a different page than
/admin/products/list.  Using your route, both /products/list and
/admin/products/list show the same page.

I was thinking that I'll need two products controllers.  (maybe name one
"AdminProductsController"?)  Is that still done through the router?

Thanks for your help!!
- Bret



Mark Wright-3 wrote:
> 
> I did it like this:
> $router->addRoute('admin',
>                             new 
> Zend_Controller_Router_Route('admin/:controller/:action',
>                                                                               
>            array('controller'   => 'admin',
>                                                                               
>                          'action'               => 'index')));
> 
> This way the url still points to /admin, but that does not affect the
> controller. I'm not sure I understand what the advantage is to using a
> rewrite rule instead of a router.
> 
> 
> Mark
> 
> On 6/4/07, clone45 <[EMAIL PROTECTED]> wrote:
>>
>> Hello!
>>
>> I'm using the Zend controller on a new site and have a newbie question. 
>> So
>> far, I've been using the controller without any problems.  I want to add
>> an
>> admin area to my site (www.mydomain.com/admin), and I think it would be
>> best
>> to create a new series of controllers to handle *just* the admin area.
>>
>> In my first attempt at solving this problem, I tried using the following
>> rewrite rules:
>>
>> RewriteEngine on
>> RewriteRule admin admin_index.php [L]
>> RewriteRule !\.(js|ico|gif|jpg|png|css|swf)$ index.php
>>
>> (On the side: admin_index.php is basically the same thing as the standard
>> index.php, but in it I specify a new path to the controllers directory,
>> namely ../application/controllers/admin.  I'm putting my admin
>> controllers
>> in there.)
>>
>> My rewrite rule doesn't quite cut it.  If I try to go to the page:
>> http://www.mydomain.com/admin, the request gets sent to admin_index.php,
>> like I want, but the action is set to "admin", since that's the first
>> parameter after the domain name.
>>
>> I want to be able to say: http://www.mydomain.com/admin/products/list or
>> http://www.mydomain.com/admin/products/edit/id/12
>>
>> Thanks for your thoughts on the subject!  Am I approaching this
>> correctly?
>> - Bret
> 
> 
> -- 
> Have fun or die trying - but try not to actually die.
> 
> 

-- 
View this message in context: 
http://www.nabble.com/How-to-set-up-controller-for--admin-area--tf3869094s16154.html#a10962291
Sent from the Zend Framework mailing list archive at Nabble.com.

Reply via email to