yes, but is it possible in your example to use Zend_Acl for access control?

On 6/5/07, Jon <[EMAIL PROTECTED]> wrote:

 The problem with that is that you get a lot of controllers in the
admin/controllers/ directory as the application grows. I use Bret's first
example in my application and have a separate section just to handle admin
tasks. I also have two bootstrap files. One for the frontend and one for the
backend.



Here is my .htaccess:



RewriteEngine on

RewriteRule ^admin(.*) backend.php [L]

RewriteCond %{SCRIPT_FILENAME} !backend.php$

RewriteRule .* frontend.php [L]

php_flag magic_quotes_gpc off

php_flag register_globals off



And here is my dir structure:



site/

            application/

                                    backend/

                                    frontend/

                                    resources/



configs/

lib/

public/

backend.php

frontend.php





Hope this helps



Jon.
 ------------------------------

*From:* Vladas Dirzys [mailto:[EMAIL PROTECTED]
*Sent:* 05 June 2007 08:07
*To:* clone45
*Cc:* [email protected]
*Subject:* Re: [fw-general] How to set up controller for /admin area?



Hey Bret,
you should use modular application layout.
In the bootstrap set the following parameter:

$front

->setParam('useGlobalDefault'

, true);


Example of your directory structure:



docroot/
    index.php
application/
    default/
        controllers/
            IndexController.php
            ProductsController.php
    admin/
        controllers/


            IndexController.php
            ProductsController.php
        models/
        views/


For more information read this:
http://framework.zend.com/manual/en/zend.controller.modular.html

Vladas

On 6/5/07, *clone45* <[EMAIL PROTECTED]> wrote:


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/listor
>> 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.




--
Pagarbiai // Gruß,
Vladas Diržys
tel.: +370 677 17851
www.dirzys.com




--
Pagarbiai // Gruß,
Vladas Diržys
tel.: +370 677 17851
www.dirzys.com

Reply via email to