Closed (duplicate)
Project:
Mobile Tools
Version:
6.x-2.3
Component:
Code
Priority:
Major
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
22 Mar 2011 at 15:14 UTC
Updated:
19 Sep 2012 at 10:04 UTC
Jump to comment: Most recent file
Comments
Comment #1
twom commentedHi,
This bug is fixed in the dev version.
I will make a new 2.2 release...
Comment #2
JonasK commentedHello Tom
Thank you for your help. I intsalled the new 2.2 release.
Unfortunatly the problem still exists. As soon as I save a default frontpage for the mobile version it automatically overwrites the the default frontpage of the desktop version with tha same value.
Comment #3
twom commentedHi,
I am not able to replay this problem. The one thing that can go wrong is that your desktop site is detected as a mobile site. Can you give me the structure of your mobile and desktop url (you don't have to give the exact urls, but is it www.domain.tld and m.domain.tld or www.domain.tld and www.domain.tld/mobile, ...)
Comment #4
JonasK commentedAs I have seen I can change the default frontpage for the mobile version within the 'mobile tools' section as well as under /admin/settings/site-information. There it seems as the 2 fields are treated as one.
See the attached pictures. I only enter the frontpage for the mobile version but after saving it changes the frontpage of the desktop version with the same value,
The problem might be that my site has the same structure for desktop and mobile version (www.domain.tld)? The theme switching is done by the option 'Switch theme for a mobile device'. Does this not work in the scenario I use?
Thanks for the help!
Comment #5
twom commentedHi Jonas,
I removed yesterday a bug that caused wrong detection of the site type in the case of having the same url for desktop as mobile.
Can you try the new code? (the current dev package should work)
Comment #6
JonasK commentedThanks, seems to be better now!
Comment #7
twom commentedThx for reporting back!!!
Much appreciated :)
Comment #8
julient commentedHi,
I was having the same problem. So I installed the latest module version 6.x-2.x-dev and ran the update.
Still, when saving, the mobile front page is overwriting the desktop front page.
My domain URL for desktop and mobile is both dev.domain.tld instead of www.domain.tld like Jonas, does it matter?
Comment #9
ryrye commentedSimilar issue for me. I've opened another issue at http://drupal.org/node/1145944 for my particular problem, feel free to close if its actually the same as this.
Comment #10
julient commentedIt could be the same issue. I haven't got an answer yet wether it mattered if the domain was www.domain.tld or dev.domain.tld.
Anyone?
Comment #11
ryrye commentedFrom scanning the code, it looked like it might be dependent on using m. and www. for your subdomains. Maybe someone can confirm? If that is the case, it might be a good idea to request that this be made more obvious in the documentation/config forms.
Comment #12
twom commentedHi All,
Probably you all configured the front page settings from the 'admin/settings/site-information' page?
I removed the setting there and just kept it in the mobile-tools configuration page... I guess it is more transparant to keep mobile configurations for now in a centralized space. I hope you can give it another try. It seems to be working for me!
Comment #13
AlexisWilke commentedHi guys,
The culprit is the $_GET['q'] used at the end of this function:
When you define two URLs you write something like this:
http://www.example.com/mobile
http://www.example.com/
The function gets one of those URL at the start:
(note: why do you do
$destination = ...in the second part?!)That destination URL is the same as the URL defined in the admin screen, thus for the Desktop it is set to:
http://www.example.com/
Then at the end of the function you do this:
which puts the /mobile right back at the end of the URL.
If I understand properly, the test:
is supposed to return before the $_GET['q'] is appended. However, that means you are missing any other parameter. Therefore, that's wrong.
And obviously, it is doubly wrong since it doesn't properly serve its real purpose. You now have TWO front pages and for either one, the $_GET['q'] needs to be ignored.
I'm going to give you a patch that corrects this problem at once.
Talk to you soon.
Alexis Wilke
P.S. twom: your solution (in #12) is not going to fly for 99.9% of the people out there.
Comment #14
AlexisWilke commentedOkay... well... actually it won't work except for the front page.
Say you enter these:
http://www.example.com/mobile
http://www.example.com/
and you create a new page, let's say node/123 is created. Assuming you are on your desktop, you go to:
http://www.example.com/node/123
That's good up to here.
Now, I do the same on my iPhone and guess what happens? Yep! I'm sent here:
http://www.example.com/mobile/node/123
And that node doesn't exist...
I guess that concept isn't going to work. So the only way is to use a sub-domain, really. Although in my case all I need is a redirect for the home page. I guess I'll look in a different solution.
Just in case there are my changes:
However, the test
if ($dest_url == $destination_mobile_url || $dest_url == $destination_desktop_url)is incorrect since one of the destination URLs is going to include a sub-path and $_GET['q'] will be node/123 and not the URL alias.Good luck.
Alexis
Comment #15
venusrising commentedCan someone from Mobile Tools post a documentation page or some how to here if we are to set up a m. subdomain how to direct it etc.
i.e m alias go to http://www.example.com? will this work without issue? Trying to clarify and it is quite unclear. Thanks
Comment #16
DanielWashbrook commentedI had a similar problem where my site_frontpage and site_frontpage_mobile were the same. For the record I don't want to use a subdomain, just have a different theme and different front pages.
Noticed in the mobile_tools.module on line 151 there's an if statement
that seems to return true whether it's desktop or mobile.
I changed the if statement to:
and now it works perfectly.
Are there any negative consequences that I didn't foresee?
Thanks!
Daniel
Comment #17
heyehren commentedI have the same problem. The custom home page feature within the mobile tools settings only works for one language. It is possible to switch languages via the language switcher, but all $front_page; style links go to the desktop version homepage in each language. None of the above worked for me and i couldn't find a clean way to fix this issue yet.
Comment #18
twom commentedComment #19
heyehren commentedJust an update: I have tried the latest dev version, but still have the same problem. I have also replaced the pieces of code as suggested by AperoMedia, but this didn't do the trick either.
I'll describe my problem again:
I used to be able to show a different front page when visiting the site on a mobile device. But something happened and now the auto-detection doesn't work anymore for the custom front page. The theme switching works fine though.
Something else i found is that i can't access the mobile front page on a mobile browser at all, but i can access it from a desktop browser.
For example, i can access the mobile front page on a desktop browser, but if i type in the url of the mobile front page in a mobile browser, i see the url of the mobile front page in the address bar but the browser shows me the desktop front page . . .
Or when i click on the "view mobile site" link on a desktop browser i can see the mobile theme plus the mobile front page without any problems. But if i do the same thing on a mobile browser i see the mobile theme with the ---desktop front page---.
Mobile tools is set to use a sub-domain for the mobile site http://m.mydomain.com/
(I have cleared the browser and Drupal cache each time i made a change as well just to be sure)
I hope this makes all sense. I'd really appreciate any help with this!
Regards,
Stefan
Comment #20
heyehren commentedHi there,
For the ones having trouble with the same issue as i had described above. Here is the solution that worked for me:
Open the mobile_tools.module file.
Comment out line 221
Add this code behind line 239:
$mobile_front = variable_get('site_frontpage_mobile', variable_get('site_frontpage', 'node'));
if (drupal_is_front_page() && (drupal_get_path_alias($_GET['q']) != drupal_get_path_alias($mobile_front))) {
drupal_goto($mobile_front);
Comment #21
geniux commentedthanks AperoMedia!
changing
mobile_tools_site_type()to
$mobile_tools_device['type']did the trick for me and now I have a homepage for mobile visitors and normal visitors without setting up a subdomain.
One important thing to mention tho: This fix only works with version 6.x-2.2 (http://ftp.drupal.org/files/projects/mobile_tools-6.x-2.2.zip)!!
Comment #22
BarisW commentedKleinermann, it seems you and I have the same problem. Because our problem is not the same as the described in this thread, wouldn't it be better to continue at my issue #1197570: Mobile front page returns desktop front page?
Comment #23
aludescher commentedAt first I thought I have the same bug, that's why I am posting this here. The block was working for me in 6.x-2.3, but the "View full site" link on the mobile front page was pointing to www.domain.com/mobile-front-page?device=desktop. I didn't like that it was sending visitors to mobile front page in the desktop theme. To change this behavior edit mobile_tools.module around line 167
Comment #24
gbowman commented#16 worked for me using 6.x-2.x-dev
Comment #25
bcobin commentedCan't find a solution here either with dev or with 2.3. Mobile front page view isn't being picked up. Have to disable mobile view now - major drag.
This used to work... now it's gone. :-(
Subscribing...
Comment #26
Toktik commentedSame problem.
I have Mobile tools 2.x-dev version installed at this moment.
Device detection and theme switching is working properly. But frontpage for mobiles specified in mobile tools settings, does not work. In mobile version I'm viewing desktop version frontpage.
I'm using m.domain.com for mobile version.
Also I noticed that if I go mobile frontpage URL (which is /mobile), I also receive desktop version frontpage (which is /front).
No one solution works from here.
Comment #27
bcobin commentedSee possibly "cleaner" thread here: http://drupal.org/node/1197570 - still no sign of a solution...
Comment #28
Toktik commentedClosing this as duplicate of #1197570: Mobile front page returns desktop front page.
We should focus in one thread.
Comment #29
drvdt commentedThanks alot,
My sites are fine with your code.
Thank AperoMedia!
You can try them:
http://tanghuyetap.vn/1?device=desktop
http://tanghuyetap.vn/1?device=mobile
{I had a similar problem where my site_frontpage and site_frontpage_mobile were the same. For the record I don't want to use a subdomain, just have a different theme and different front pages.
Noticed in the mobile_tools.module on line 151 there's an if statement
if (mobile_tools_site_type() == 'mobile') {
that seems to return true whether it's desktop or mobile.
I changed the if statement to:
if ($mobile_tools_device['type'] == 'mobile') {
and now it works perfectly.
Are there any negative consequences that I didn't foresee?
Thanks!
Daniel}
Comment #30
j4 commentedHI, Which version of mobile tools are you using?
Thanks
Jaya
Comment #31
gunnermultimedia commentedI experienced the problem in 7.x-2.x. #16 fixed the issue. Note that the if statement is on line 220 in this version.
Comment #32
benchesters commentedThanks very much Daniel (#16), taken me ages to work this out. Works perfectly for me mob tools version = "6.x-2.4"