2011年2月10日星期四

Re: [fw-mvc] Theming Idea

On Thursday 10 Feb 2011 20:01:22 Hector Virgen wrote:
> On Thu, Feb 10, 2011 at 12:38 AM, Jurian Sluiman
> <subscribe@juriansluiman.nl
>
> > wrote:
> >
> > Create a frontController plugin which hooks at an early stage and
> > use WURFL (eg the Zend Http browseragent component) to look is a mobile
> > switch
> > should be set.
> > If so, change your view extension from .phtml to .mobile.phtml. Then you
> > can
> > use your normal layout.phtml and layout.mobile.phtml and as well for the
> > views: instead of index.phtml it would become index.mobile.phtml.
>
> I second Jurian's idea but it could probably be improved by extending the
> ContextSwitch action helper to support switching to a mobile context using
> the same logic that his plugin would use. However the action helper would
> let you control which actions will support a mobile view in case you are
> not theming the entire site.
>
> --
> *Hector Virgen*
> Sr. Web Developer
> http://www.virgentech.com

We use indeed this approach as wel at our company. The frontController plugin
checks if we have a mobile device and if so, we can switch to a mobile layout.
An extension of the contextSwitch lets us determine on controller/action base
if we want a special view in case we have a mobile request.

Regards, Jurian
--
Jurian Sluiman
Soflomo - http://soflomo.com

没有评论: