> I have an idea for theming, but I would like some feedback before
> implementing it. By theme, I mean platform-specific views. Like if I want
> to display a mobile version of a site.
>
> I will only be using one set of controllers and one set of models. The
> views will change depending on the theme. Since my controllers and models
> will not change, I would like to put them in the library and reference them
> there. If I can successfully do that then my modules will only have views
> and layouts. So why not use modules as my theme container?
>
> If the user is viewing on a mobile device, then I can intercept in a
> controller plugin and change the module on the fly. Or I can set up routing
> to go to a hostname specific route and redirect.
>
> Any feedback?
>
> -----
> - Joe
I don't think you should use the module directory as a theme directory. Your
models and controllers are application logic and should be in the app, not the
library.
If you only want to switch views for a mobile version, I'd do it somewhat
different. 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.
Then you keep all your views at the right place and is it much easier to
maintain.
Regards, Jurian
--
Jurian Sluiman
Soflomo - http://soflomo.com
没有评论:
发表评论