Switch link to mobile theme

Last edited on Mon, 2012-08-13 14:01

I use Android phone and feel Mobile theme is unnecessary for my nexus one. But I made this site has function to switch theme for mobile using UA of a browser.
I used MobileTheme module but recently I changed to SwitchTheme for that.

The user can switch an effective theme. It provides block menu for the theme switch. On this site, I put a link to switch for Mobile and for PC at the bottom of a page. Theme for PC has a switch link to mobile theme and a theme for mobile has a switch link to PC theme.

Installing just like a usual module, and setting the user authority enable even an anonymous user to use the switch function.

Next, display the link to switch to the another theme respectively of the theme for PC and the theme for Mobile. When SwichTheme is made effective, the theme can be switched by adding '?theme=' to URL. To use this function, I put the following functions in template.php.

function nyanchew_preprocess_page(&$vars, $hook) {
$vars['footer_message'] = l('Change to Mobile theme', $_GET['q'], array('query' => 'theme=mobile')$
}

The switch link to a mobile theme is displayed in footer with the string 'Change to Mobile theme'.

In addition, SwitchTheme can specify the theme by synchronizing with the Browsecap module. Seeing UA of a browser, a browser named DoCoMo, KDDI, and NetFront displays it by the theme for Mobile.

Comments

can you tell us how you added mobile adsense for mobile content to your drupal mobile site. (though i am not seeing it on the mobile site

Thank you for the comment.

I inserted AdSense code directly into a page.tbl.php file under a mobile theme folder.