【发布时间】:2011-02-20 07:51:04
【问题描述】:
开发一个插件,我的插件目录中有一个 routing.yml,用 sfPropelRoute 指定一个路由。
在我的 plugins/myPlugin/config/routing.yml 中:
myplugin_test:
url: /myurl/:id
class: sfPropelRoute
options: { model: myClass, type: object, method_for_criteria: selectAvailableObj }
params: { module: mymodule, action: show }
requirements:
sf_method: [GET, POST]
效果很好。
但是,在我的应用程序 (apps/myapp/config/routing.yml) 中,我想定义一个具有人类意义的绝对 URL 我想做这样的路由:
my_profile:
url: /my-super-profile
class: sfRoute
params: { route: @myplugin_test, id: 1 }
显然,我的语法不正确!
【问题讨论】:
-
您所指的绝对网址在哪里?请注意,如果您将“absolute =>”true”参数传入,则 url_for 和 link_to 都能够从路由规则生成绝对 URL。
-
我认为 mere-teresa 指的是
/my-super-profile,它应该给出与/myurl/:id相同的页面,其中id是 1。所以不是绝对的,但可能是静态 url?