Creating a mobile theme

We close the chapter with a short guide to creating a mobile theme. Elgg's view system makes it easy to create a theme for mobile devices. A mobile theme creates another viewtype that is used whenever a mobile browser is detected. In Chapter 7, we discussed how Elgg uses a default viewtype to serve web pages to a browser and an rss viewtype to serve RSS feeds to a feed aggregator. The logic and data are the same for different viewtypes, but the rendered output is different. For a mobile theme, we create a mobile viewtype and switch to this viewtype whenever a mobile browser is detected.

Plugin structure

Our mobile theme is structured like the preceding theme except that instead of putting the views in views/default/, they ...

Get Elgg 1.8 Social Networking now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.