This guest post was written by Klemens Ullmann-Marx, a web developer in Vienna and founder of the company ull.at.
Stumbling over a post in the symfony-users list I wrote down some information on how we manage mobile sites in our ullright platform. There's an old blog post about creating a symfony iPhone view. Most of it is still valid and it works.
But there is one serious drawback: You have to provide a mobile template for each action. That's why we created a tiny patch to provide a fallback to normal templates in case there is no special mobile one.
Here are the required parts:
- Mobile detection: This belongs into your project configuration;
- Symfony patch for
sfView.class.phpenabling fallback to html templates.
Finally, provide a mobile template (or not): Normally you would put your
you can provide a mobile template by creating the following file:
This also works for layouts, partials and components. Example:
Have a nice day!