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
精彩评论