I found also you can add .sf_format to a layout: layout.mobile.php to automatically use that layout when sf_format is not html
(this was mentioned above my klemens_u) On Sep 8, 1:48 pm, Gustavo Adrian <comfortablynum...@gmail.com> wrote: > You could create a custom layout for mobile sites. Then, in the action: > > $this->setLayout( 'myMobileLayout' ); > > You could create a custom "base" action that extends from sfActions, where > you check for the "sf_format" value for the request in the "preExecute" > method. Then, based on that value, set the layout you need. Finally, extend > every action from this "base" action. For example: > > *class myBaseAction extends sfActions > { > public function preExecute() > { > if ( $this->getRequest()->getParameter( 'sf_format' ) == 'mobile' ) > { > $this->setLayout( 'myMobileLayout' ); > } > }} > > * > Then in your action > > class myOwnAction extends myBaseAction > { > public function preExecute() > { > parent::preExecute(); > > // More stuff > } > > } > > Regards. > > On Wed, Sep 8, 2010 at 2:26 PM, Kevin <kevinb...@gmail.com> wrote: > > How do you get it to work for layouts? > > > On Sep 7, 8:40 am, Kevin <kevinb...@gmail.com> wrote: > > > Thanks, this stuff is great. Never thought of that. > > > > On Sep 7, 3:49 am, klemens_u <klem...@ull.at> wrote: > > > > > Hi, > > > > > it's basically really just a question of view. > > > > > Here's an old blog post about creating an iphone view: > >http://www.symfony-project.org/blog/2008/06/09/how-to-create-an-optim... > > > > Most of it is still valid and it works. > > > > > But there is one serious drawback: You have to provide amobile > > > > template for each action. > > > > That's why we created a tiny patch (for our "ullright" platform) to > > > > provide a fallback to normal templates in case there is no > > specialmobileone. > > > > > Here are the required parts: > > > > > Mobiledetection: This belongs into your project configuration: > >http://trac.ullright.org/browser/trunk/plugins/ullCorePlugin/config/u... > > > > > Symfony patch enabling fallback to html templates: (Patches > > > > sfView.class.php) > >http://trac.ullright.org/browser/trunk/plugins/ullCorePlugin/patch/sf... > > > > > Finally provide amobiletemplate (or not): > > > > Normaly you would put your template in apps/frontend/modules/myModule/ > > > > templates/myActionSuccess.php > > > > Now you can provide amobiletemplate by creating the following file: > > > > apps/frontend/modules/myModule/templates/myActionSuccess.mobile.php > > > > > This also works for layouts, partials and components. Example: apps/ > > > > frontend/modules/myModule/templates/_head.mobile.php > > > > > Have a nice day, > > > > > Klemens > > > > > On 6 Sep., 00:29, Alexandre Salomé <alexandre.sal...@gmail.com> wrote: > > > > > > It's just a question of view. > > > > > > You should create dedicated routes with a sf_format "mini" > > > > > > 2010/9/2 Dennis <gear...@sbcglobal.net> > > > > > > > Rather than go the plugin route, why not use either a '.mobi' tld, > > or > > > > > > '.movi' subdomain, and symlinnk any directories that you need > > between > > > > > > the two projects? > > > > > > > On Sep 1, 4:57 am, Benoit Montuelle <benoit.montue...@gmail.com> > > > > > > wrote: > > > > > > > I've done it by adding specific layout, templates and stylesheet > > to the > > > > > > existing app. > > > > > > > > You can trigger events in your project configuration upon user > > agent to > > > > > > change templates and specific configuration. > > > > > > > > The strategy to use another app depends wether yourmobileapp > > should > > > > > > have the same functionnality as the 'classic' web app does, but it > > will be > > > > > > easier if most code still shared. > > > > > > > > -----Original Message----- > > > > > > > From: Kevin <kevinb...@gmail.com> > > > > > > > Sent: mercredi 1 septembre 2010 12:51 > > > > > > > To: symfony users <symfony-users@googlegroups.com> > > > > > > > Subject: [symfony-users]mobilesite strategy > > > > > > > > I am wondering what others have done to create amobilesite for > > their > > > > > > > symfony projects (when more than just a handheld stylesheet is > > > > > > > required). > > > > > > > > What I am planning on doing is moving all my modules to a plugin > > and > > > > > > > creating another app called 'mobile'. I can then override any > > modules > > > > > > > I need optimized for amobiledevice. > > > > > > > > What strategies have you come up with? Is there an agreed upon > > best > > > > > > > practice? > > > > > > > > -- > > > > > > > If you want to report a vulnerability issue on symfony, please > > send it to > > > > > > security at symfony-project.com > > > > > > > > You received this message because you are subscribed to the > > Google > > > > > > > Groups "symfony users" group. > > > > > > > To post to this group, send email to > > symfony-users@googlegroups.com > > > > > > > To unsubscribe from this group, send email to > > > > > > > symfony-users+unsubscr...@googlegroups.com<symfony-users%2bunsubscr...@googlegroups.com> > > <symfony-users%2bunsubscr...@googlegroups.com<symfony-users%252bunsubscr...@googlegroups.com> > > > > > > > > For more options, visit this group athttp:// > > > > > > groups.google.com/group/symfony-users?hl=en > > > > > > > -- > > > > > > If you want to report a vulnerability issue on symfony, please send > > it to > > > > > > security at symfony-project.com > > > > > > > You received this message because you are subscribed to the Google > > > > > > Groups "symfony users" group. > > > > > > To post to this group, send email to > > symfony-users@googlegroups.com > > > > > > To unsubscribe from this group, send email to > > > > > > symfony-users+unsubscr...@googlegroups.com<symfony-users%2bunsubscr...@googlegroups.com> > > <symfony-users%2bunsubscr...@googlegroups.com<symfony-users%252bunsubscr...@googlegroups.com> > > > > > > > For more options, visit this group at > > > > > >http://groups.google.com/group/symfony-users?hl=en > > > > > > -- > > > > > Alexandre Saloméhttp://alexandre-salome.fr > > > -- > > If you want to report a vulnerability issue on symfony, please send it to > > security at symfony-project.com > > > You received this message because you are subscribed to the Google > > Groups "symfony users" group. > > To post to this group, send email to symfony-users@googlegroups.com > > To unsubscribe from this group, send email to > > symfony-users+unsubscr...@googlegroups.com<symfony-users%2bunsubscr...@googlegroups.com> > > For more options, visit this group at > >http://groups.google.com/group/symfony-users?hl=en -- If you want to report a vulnerability issue on symfony, please send it to security at symfony-project.com You received this message because you are subscribed to the Google Groups "symfony users" group. To post to this group, send email to symfony-users@googlegroups.com To unsubscribe from this group, send email to symfony-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/symfony-users?hl=en