Path prefix 'm' for mobile version of a drupal site.

We encourage users to post events happening in the community to the community events group on https://www.drupal.org.
valkum's picture

For a project of mine, I'm looking for a solution to the following problem. I want to show for a path prefix, a mobile version of my site. So if someone calls http://www.mysite.de/m/ he will see the mobile portal. On http://www.mysite.de/ he will see the normal site. Unfortunately I have not found any possibility to create own path prefixes.

Do you have any ideas?

Comments

Simpler

yelvington's picture

Redirect www.example.com/foo to m.example.com/foo, and use the Domain Access module to force the latter domain to use a mobile template.

http://jacksonville.com/sports
http://m.jacksonville.com/sports

The problem is that we use

valkum's picture

The problem is that we use multiple subdomains for languages e.g. de.mysate.com for german and en.mysite.com for english.
And our DNS server (hetzner) don't support subdomain entries. In this fact we have to host a dns server (bind9) on our server only to serve the subdomains m.de.mysite.com and m.en.mysite.com (some others)
this is a little bit stupid.

any other ideas?

I handled a similar situation

Jamie Holly's picture

I handled a similar situation with a custom module. Basically it does a hook_init and does an explode('.',$_SERVER['HTTP_HOST']); It then checks if the first part == 'm'. If so it sets the global $custom_theme to the mobile theme and defines IS_MOBILE to true. The last part gives me a way to switch some panels using context rules on defined('IS_MOBILE') to generate different panels on the mobile site.

The whole custom module is about 20 lines in code, so it's a quick and easy method to get it working.


HollyIT - Grab the Netbeans Drupal Development Tool at GitHub.

consider using mobile_tools

arebos's picture

consider using mobile_tools module.

I live in Depok, near Jakarta, Indonesia. I worked full time, but I can be hired to work as a freelance or doing a project from outside. Mostly, I work with Drupal, but sometimes with Wordpress too.

<a href

Mobile

Group organizers

Group categories

Mobile

Group notifications

This group offers an RSS feed. Or subscribe to these personalized, sitewide feeds: