开发者

symfony 1.4 routing with sf_format

I'm doing 开发者_如何学JAVAmobile detection and setting sf_format to 'mobile' as per these instructions.

But I'm having trouble creating separate routes for the mobile format. Is it possible to have two routes with the same url? The following setup isn't working for me:

mobile_homepage:
  url: /
  param: { module: mobile, action: index, sf_format: html }
  requirements:
    sf_format: mobile

homepage:
  url: /
  param: { module: site, action: index }

The mobile_homepage route is always matched regardless of sf_format.


When you write

  param: { module: mobile, action: index, sf_format: html }

You set the 'sf_format' to 'html' for this URL. Just write

  param: { module: mobile, action: index }

instead.

Also, when you use "requirements" it should be used like written here:

http://www.symfony-project.org/blog/2008/06/09/how-to-create-an-optimized-version-of-your-website-for-the-iphone-in-symfony-1-1

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜