[Product-Developers] Re: Vary the display view by url/domain

Martin Aspeli optilude+lists at gmail.com
Thu May 21 10:10:46 UTC 2009


David Bain wrote:
> I would like the pages in my site to use a custom template
> "mobile_view" if accessed via http://mobile.{mysite}.com
> but to se the normal "document_view" otherwise.

If you use Z3 views, at least, you can install an on-traverse hook that 
adds a marker interface to the request if the URL has that pattern, and 
then register the alternate views for layer=".interfaces.IMobile" or 
whatever.

Martin

-- 
Author of `Professional Plone Development`, a book for developers who
want to work with Plone. See http://martinaspeli.net/plone-book





More information about the Product-Developers mailing list