Closed (fixed)
Project:
ThemeKey Properties
Version:
6.x-2.3
Component:
User interface
Priority:
Normal
Category:
Support request
Assigned:
Unassigned
Reporter:
Created:
3 Nov 2010 at 21:46 UTC
Updated:
23 May 2012 at 12:19 UTC
Jump to comment: Most recent
Comments
Comment #1
mkalkbrennerYou can use the properites system:user_browser_simplified and system:user_os_simplified to detect diferent mobile devices. One of the tutorials included in ThemeKey uses system:user_os_simplified to detect iOS.
If you enable ThemeKey Debug you can see the values of these properties when you access the page. I suggest to install the Firefox extension User Agent Switcher to do so.
From my point of view there's no need to use another mobile detection script. But could you provide a link to that script, so we can see if we miss something in our code?
Comment #2
jaarong commentedThis is the script that someone pointed me in the direction of using. I use it now on our main Drupal site to redirect all mobile devices to the mobile site.
http://detectmobilebrowsers.mobi/
Comment #3
emptyvoid commentedIt would be interesting to either integrate with or think about building a token/theme key bridge to leverage the module WURFL API or the mobile tools modules.
For those interested here are two modules that address mobile. However it would be interesting to bridge the functionality and make it available within theme key.
http://drupal.org/project/wurfl
http://drupal.org/project/mobile_tools
Comment #4
jaarong commentedWhat I ended up doing is using ThemeKey system:user_os_simplified to identify whether it was an iPhone, Android, or Blackberry. Everything else gets the simpler template. This works, but it has the same problem that I've found with every other mobile detection through php, you can't use cache. Since mobile doesn't get the numbers to really justify caching, it's fine for now, but I'm sure it will get to a point where it won't be.
Comment #5
mkalkbrenner@#4 subnet_rx:
I had a quick look at the mobile_tools module. I think it's theme switching does not support page caching as well.
But you can try this:
Use mobile_tools to redirect the mobile devices to subdomain like mobile.example.com. Then use ThemeKey Properties 6.x-2.x in combination with ThemeKey 6.x-3.x to create a rule that matches the subdomain using system:host. Now you should be able to use page caching because mobile_tools uses hook_boot for the device detection and page caching uses the sub domain as part of the cache id.
I did't try it, but I guess it will work.
Comment #6
emptyvoid commentedInteresting idea @mkalkbrenner I could also use the Domain Access module to split out each domain and write a few hooks to enable theme key to be domain access aware.
Domain Theme may do the trick or maybe using the hook_domainconf() to set theme key per domain settings.
http://api.therickards.com/api/function/hook_domainconf/domain
module I mention.
http://drupal.org/project/domain
Comment #7
jaarong commentedI do split out the domain, but the detection across the board (from what I understand) is php. So, you wouldn't be able to detect that it was a mobile phone and send it to the mobile site if caching was on. Then, when it gets there, I need to know what kind of mobile phone so I can display the correct theme.
Right now, we use JS for detecting if it's a mobile phone, and simply display a banner to promote the mobile site. Since JS detection is kind of spotty, we don't automatically redirect. I've read about some techniques using Varnish that help with caching and detection, but we don't use Varnish as our caching server.
Comment #8
atisa commentedI have used Domain Access module to add multiple sub-domains to my Drupal site. Each sub-domain has its own theme, blocks, contents and menu but some of the contents are shared among the sub-domains. In general my website looks like this:
sub1.example.com
sub2.example.com
sub3.example.com
sub4.example.com
I can use Mobile_tools module to set up one of these domains, but what can I do for the rest of the sub-domains?
Comment #9
mkalkbrenner@atisa:
First you have to decideto use mobile tools OR themekey.
Comment #10
atisa commentedI would like to use Themekey but in order to solve the cache problem I want to assign different URLs for mobile visitors. So I decided to use Mobile Tools to define mobile URL for each of the subdomains. But Mobile Tools only accepts one desktop url and one mobile url. If there is any way that I can solve the cache problem with Themekey I would definietly use Themekey module. Any suggestions would be appreciated.
Comment #11
mkalkbrennerI don't see why mobile tools or drupal itself are used to setup sub domains.
That's a part of your webserver and dns configuration.
My recomandation:
1. unistall mobile tools
2. setup your webserver and dns to make your drupal installation accessible via different sub domains (in your case 8 sub domains, 4 for your normal sites and Domain Access and 4 mobile sub domains)
3. configure theme key to use different themes for different sub domains
I hope that this works, but domain access is known not to be compatible with anything else.
BTW which version of themekey are you using?
Comment #12
atisa commentedThanks for your response. I have already setup my server and all the sub domains are accessible. Themekey works perfect with theme switching and all the subdomains have their themes assigned through Themekey. The problem is that if the device is mobile I need to switch the url from sub1.example.com to m.sub1.example.com and from sub2.example.com to m.sub2.example.com and ... I do not think that can be done with Themekey!
And to answer you question about my Themekey's version, I am using version 6.x-4.0.
Comment #13
mkalkbrennerOK. So the remaining issue is the redirect to a mobile sub domain. This could be done by a few lines of php code. But I don't know a module for that ...
Comment #14
mkalkbrennerno feedback
Comment #15
suncorjohn commentedsubnet_rx how did you setup the system:user_os_simplified settings in Themekey?
Did you just use:
system:user_os_simplified = android, iphone, blackberry
Thx,
John
Comment #16
olivm_fr commentedJohn, you may use
system:user_os_simplified ~ (Windows Phone|iPhone|iPad|Symbian|webOS|Android|Blackberry)Olivier