开发者

zend framework - creating controller for admin/action1/action2

开发者 https://www.devze.com 2023-02-11 14:31 出处:网络
In zend framework, how do i create an action for this type of url: example.com/admin/create/category which would show a page for creating a ne开发者_如何转开发w category

In zend framework, how do i create an action for this type of url:

example.com/admin/create/category

which would show a page for creating a ne开发者_如何转开发w category

or

example.com/admin/edit/category/id

which would show a page to edit a category

here, admin would be the controller, create and edit would be the action but what about the last parameter 'category'? should i check for 'category' argument inside the controller actions or is there another way ?

thanks


Having this kind of issue, I suggest using zend route. Here's the link

http://framework.zend.com/manual/en/zend.controller.router.html

You can create multiple routes for each action if needed.


I think that the good way is to check for 'category' argument inside the controller actions. Based on its value you do what you want.


Assuming you have lots of different "things" you need to administer then i woudl suggest not using ana single admin controller but rather a Category controller. Then just secure the admin actions. Alternatively you sould have 2 controllers a Category controller and an AdminCategory controller...But either way you should have multiple controllers for the admin module....

Also keep in mind you can set up routes pretty much however you like... not every segment in the url needs to map to a parameter...

0

精彩评论

暂无评论...
验证码 换一张
取 消