-->

How to create admin in Zend framework?

2020-08-01 03:00发布

问题:

I am a Zend developer and I have developed one application without an admin panel. Now I want to develop an admin panel for that, so how can I develop it from the start?

  1. What do I have to write for the redirect to the admin panel like "http://localhost/zend/public"?

  2. How do I add an admin controller or module?

  3. Layout of admin.

  4. Where do I put an admin folder or what do I change in Bootstrap?

回答1:

Well there are many ways. It depends on what sort of admin interface you actually need.

But usually:

1) You should have a separate module for the admin interface. That implies module based MVC structure.

2) You will want to use Zend_Acl to define user access list. I.e. create roles (for instance: guest, user, moderator, admin) and define what modules/controllers/actions they should have or should not have access to.

3) Use Zend_Auth to authenticate users.

4) Probably propagate the user information through session using Zend_Session and Zend_Session_Namespace.

5) Do at least basic security measures (prepared statements against SQL injections and $this->view->escape against XSS, possibly use CSRF token for all forms). If it is a commercial application, get a certificate.