I am using Mobile tools with option to swithc theme by url and it works fine. I created a menu for the mobile environnement but I don't want to use absolute path for menu links (such as http://mobile.mydomain.com/a-page) but rather use a relative path. I do that because I am using features to sync changes on multiple environments (local, dev, production ) so I don't have to change the base url each time. The problem is that I can't get the mobile base path on this menu but the desktop menu. I mean when I am in http://mobile.mydomain.com/a-page, the page is rendered as mobile but the primary menu is using http://WWW.mydomain.com/a-page.

Any solution?
Thanks

Comments

thumperstrauss’s picture

I think my problem is similar.
http://drupal.org/node/1197570

Also curious about the answer.

mikaoelitiana@gmail.com’s picture

I found a temporary solution for it but I think there must be another solution. I just replaced all occurrence of the desktop URL by the mobile URL putting the following code in template.php of the theme i used :

$exploded = explode('/', $_REQUEST['q']);
if ($exploded[0]!='admin') {
$desktopUrl = variable_get('mobile_tools_desktop_url', '');
$mobileUrl = variable_get('mobile_tools_mobile_url', '');
$vars['language']->domain = $mobileUrl;
$vars['content'] = str_replace($desktopUrl,$mobileUrl, $vars['content']);
$vars['primary_menu'] = str_replace($desktopUrl,$mobileUrl,$vars['primary_menu']);
$vars['primary_links_tree'] = str_replace($desktopUrl,$mobileUrl,$vars['primary_links_tree']);
$vars['footer'] = str_replace($desktopUrl,$mobileUrl,$vars['footer']);
$vars['front_page'] = str_replace($desktopUrl,$mobileUrl,$vars['front_page']);
$vars['content'] = str_replace($desktopUrl,$mobileUrl,$vars['content']);
}
}