doxzrb8721 2009-12-14 15:46
浏览 331

Zendframework路由问题

I have been setting my routes in my application.ini file which works for all the ones i have setup. The problem is when there are multiple actions within that controller and i try to use the routes in other actions.

For instance i have created the following in my application.ini for paging and column sorting

resources.router.routes.search.route = "search/:page/:col/:sort/:limit/"
resources.router.routes.search.defaults.controller = search
resources.router.routes.search.defaults.page = 1
resources.router.routes.search.defaults.col = time
resources.router.routes.search.defaults.sort = default
resources.router.routes.search.defaults.limit = 50
resources.router.routes.search.reqs.page = \d+
resources.router.routes.search.reqs.col = \w+
resources.router.routes.search.reqs.sort = \w+
resources.router.routes.search.reqs.limit = \d+

The above works when I'm on the default action of that page like

www.mywebsite.com/search/2/

Would bring up the second page of the results. But if I try the same on another action,

www.mywebsite.com/search/action/2

It just shows a blank page. I tried creating its own settings in the ini and that did not work. I've run across this problem before but usually just gave up and separated things into different controllers but i would rather have different actions.

Any help would be much appreciated.

Matt

  • 写回答

2条回答 默认 最新

  • douyi4544 2009-12-14 16:42
    关注

    search/:page/:col/:sort/:limit/ doesn't match www.mywebsite.com/search/action/2. Your route is looking for search/ followed by a digit (\d) that represents the page number; however, you're requesting search/ followed by the string action. I would suggest adding another parameter to your route: search/:action/:page/:col/:sort/:limit, defaulting action to index.

    Requesting the first page of the default action stays the same (search). Requesting page 2 of the default route will now be search/index/2/, but you can now specify a different action (search/action/2).

    评论

报告相同问题?

悬赏问题

  • ¥15 关于#Java#的问题,如何解决?
  • ¥15 加热介质是液体,换热器壳侧导热系数和总的导热系数怎么算
  • ¥15 想问一下树莓派接上显示屏后出现如图所示画面,是什么问题导致的
  • ¥100 嵌入式系统基于PIC16F882和热敏电阻的数字温度计
  • ¥15 cmd cl 0x000007b
  • ¥20 BAPI_PR_CHANGE how to add account assignment information for service line
  • ¥500 火焰左右视图、视差(基于双目相机)
  • ¥100 set_link_state
  • ¥15 虚幻5 UE美术毛发渲染
  • ¥15 CVRP 图论 物流运输优化