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 an 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 enabling fallback to html templates: (Patches sfView.class.php)

Finally provide a mobile template (or not):
Normaly you would put your template in apps/frontend/modules/myModule/templates/myActionSuccess.php
Now you can provide a mobile template by creating the following file: apps/frontend/modules/myModule/templates/

This also works for layouts, partials and components. Example: apps/frontend/modules/myModule/templates/

Here’s the original post:

Have a nice day!

5 Comments | Category: Best Practices

Hi! A warm welcome to Web Mozarts also from my side. It took some time to write my first post, but here it is!

Your app is slow? If the symfony web debug toolbar doesn’t give you the details you want, you can take a real deep look into your application using the profiling options of Xdebug.

In this tutorial we will set up Xdebug to profile your application and then we’ll analyse the output with KCachegrind.

By the way: Xdebug has a lot of other useful features. One that comes automatically is the nicely formated php debugging output in case of errors including the full call stack. KCachegrind on the other hand has very interesting graphical output features like the call graph. In the case of symfony the call graph can be like an interesting expedition into the functionality of the framework.

Read the rest of this entry »

5 Comments | Category: Tips & Tricks

Additional Resources