Thanks for the great module! It seems like this would be the perfect fit to the site I'm working on, except for one problem.. the frontpage for mobile is not working. What I did:

- I created a view with only news items (title plus image), included a Page display and the url 'mobile'
- On the Mobile Tools page, I've set the mobile frontpage to 'mobile'
- When I visit the frontpage from my desktop, I see the normal frontpage
- When I visit the frontpage from my mobile, I get redirected to m.mydomain.com with the mobile theme.

So far so good, except for the fact that the frontpage on the mobile version is not displaying the content from /mobile, but from /node. Even if I enter the path m.mydomain.com/mobile manually, I still see the default teaser view (ten promoted teasers) instead of my custom view. So I opened the page.tpl.php from the themes folder and printed arg(0), which returned 'node' instead of 'mobile'.

The weirdest thing is, is that www.mydomain.com/mobile returns the correct view, while m.mydomain.com/mobile doesn't.

Any ideas? I tried 2.3, 2.2 and 2.x-dev, no luck with any of them.

CommentFileSizeAuthor
#25 mobile_tools.patch791 bytesandrewsuth
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

BarisW’s picture

Seems to be the same problem as http://drupal.org/node/1101560#comment-4530834

bcobin’s picture

Yes - although this description is more succinct and describes precisely what I'm experiencing, without the domain issues discussed in the other thread.

Has anyone found a solution for this? The mobile view used to work; now I've had to disable Mobile Tools until this is resolved. Bummer. (Otherwise, terrific module - thanks, Twom!)

bcobin’s picture

Bumping this - the front page view definitely worked at some point; I would be happy to fall back to the earlier version and forego the "latest and greatest" code just to get it working again. It looks like much of the activity has been on the D7 branch, but it sure would be nice to have the alternate front page working once more in D6.

I have MT installed (although not exposed) on a deployed site with domain switching (deactivated), so Thom, please feel free to reach out to me if you want to poke around. Thanks much!

BarisW’s picture

@twom: any idea what's causing this? And more important: how to fix this?
Thanks a lot!

Toktik’s picture

Title: Mobile front page returns /node » Mobile front page returns desktop front page

I have same problem. But one clarification.

Are your default frontpage(desktop) is /node? Mine is Views based frontpage.

Actually I'm getting desktop version's frontpage in mobile version. Doesn't matter it's /node or views based or something else.

Toktik’s picture

Priority: Normal » Critical

Actually this is critical, because we can't continue mobile version development without fixing this.

jboeger’s picture

subscribing!

smithcrew4’s picture

subscribing!

Jens Peter’s picture

I have a similar issue but my front page is showing correct until I try to get back to it. I wrote about it here: http://drupal.org/node/703708
But as it is similar I thought I would link to this one as well. Hope this is the correct way of doing it.

DoktorNo’s picture

Subscribing! I had replicated this error on my setup (version 6.x-2.3).

BarisW’s picture

@twom: any change to look into this issue?

bcobin’s picture

Bumping this again - this is really a show-stopper. Frustrating thing is that it used to work at one point. Any ideas? Thanks... standing by!

bcobin’s picture

Been stuck here on mobile development now for several months; I'm starting in on a new project this week where the client will not be so understanding when it comes to mobile.

I don't know where Tom went - it's now been three months since there have been any code updates and that's pretty scary, especially with a problem of this magnitude. It's a particular shame in that this functionality did, indeed, work at some point.

To refresh, I'm using /frontpage for the site and a derivative of the /frontpage view for mobile (/mobile) that displays titles only. Redirection seems fine, but the mobile site displays the full node. I fear I'll have to look into using ThemeKey or something - this is a major drag.

Tom - hope all is well with you! Anybody else: any ideas? Would a bounty help? :-(

BarisW’s picture

I've created a page view '/mobile' to load for the mobile view. I've set both the default frontpage and the mobile front page to /mobile. This worked for me, it might help you as well?

bcobin’s picture

I've created a page view '/mobile' to load for the mobile view. I've set both the default frontpage and the mobile front page to /mobile.

Thanks for your input, BarisW, but the whole point is to have one front page for regular users and different one for mobile. We're happy with the /frontpage view (which is what the site is using); the whole problem is that the /mobile view doesn't work. I need front-page-promoted titles only, not the teaser, which is what the /frontpage view generates.

Most frustrating is that I had a back and forth with Thom at one point and it was working - it's since been "broken" somehow. *sigh*

Thanks anyway...

BarisW’s picture

I know your problem, but still.. did you try my suggestion?
Setting both the front_page urls to the mobile one? I did and somehow it worked (it only uses the /mobile view if I set the default view to /mobile as well).

Anyhow, I full agree with you that its quite frustrating that it stopped working as it should be.

bcobin’s picture

@BarisW,

I set the default view to "mobile" and indeed, the front page for non-mobile uses showed the mobile view, not frontpage. Great for mobile users, I suppose - not so great for everybody else. So no luck there.

(Even if it did work, that is so majorly wrong I don't know if I could deal with it.)

Thanks for caring, really. Effectively, this means that MT as it currently exists is a dead end for mobile development until this gets fixed.

I think I am going to cry now... :-(

Thanks anyway...

jeremyasmith’s picture

I have a similar problem (I think), My site will switch to m. url but will display the default theme (garland) instead of the mobile theme (mobile garland). However I notice that if I log on and go to any administration page it switches themes correctly to the mobile theme, but when I go back to a 'normal' page (still logged on) it goes back to garland?

bcobin’s picture

I think I've managed to work around the bug by using Apache mod_rewrite to redirect mobile visitors to the actual front page I want.

MT seems to "swallow up" the mobile front page, so here's what I did:

1. Create desired mobile front page in Views.

2. Clone desired mobile front page view and give it a different name. For example, my mobile front page is "mobile" and the clone is named "mobilefront."

3. Set MT to read "mobile" view as front page.

4. Edit .htaccess as follows:

RewriteCond %{HTTP_HOST} ^www\.[sitename]\.com$ [NC]
RewriteRule ^(.*)$ http://[sitename].com/$1 [L,R=301]

#The above two lines will force 'www' site visitors to 'http://'. You don't need the explanatory line you're reading now in your .htaccess file; I'm just explaining here on the forum.
  
RewriteCond %{HTTP_HOST} ^m.[sitename].com$
RewriteRule ^/?$ "http\:\/\/m\.[sitename]\.com\/mobilefront\?device\=mobile" [R=301,L]

This seems to be working for me, so far. At least I can get moving; I hope this gets fixed soon, though... MT is otherwise terriffic...

bcobin’s picture

Never mind - I spoke too soon.

Yes - using mod_rewrite you can actually get the alternate front page for mobile, but the problem is there's then no way for the mobile user to see the full front page; it will always redirect.

So this isn't a solution.

Has anyone figured out how to make the mobile front page work in 6.x? (it used to at one point - really, it did.) Thanks...

DanielWashbrook’s picture

I'm using the same url with a different frontpage (view) for mobile users.

I just upgraded to 2.3 and the problem is still there. It seems the mobile_tools_boot() function calls this function:
mobile_tools_site_type()
to see if it's of type mobile and no matter what, it comes back as 'desktop'.

My solution is to compare the value of $mobile_tools_device['type'] instead. It looks like this:

if ($mobile_tools_device['type'] == 'mobile') {
    $conf['site_frontpage'] = variable_get('site_frontpage_mobile', variable_get('site_frontpage', 'node'));
}

on line 199 of mobile_tools.module

It worked great before, works great again. Is this a reasonable solution? Should I make a patch?

Daniel

Anonymous’s picture

Status: Active » Needs review

Thanks Daniel, that worked for me (Drupal 7.12).

EDIT: I fortunately have to say that the problem came back when I enabled page cache for anonymous users.

Anonymous’s picture

fitacamp12’s picture

Status: Needs review » Active

Hello to everybody!!

I have the same problem as all of you. I can not change the frontpage for the mobile view. As everybody I'm using the same url with a different frontpage (panel) for mobile users.

Of course I have set my new mobile frontpage at "Choose another frontpage for mobile visitors.:" as "mobile-frontpage".

I have tried Daniel's solution,

if ($mobile_tools_device['type'] == 'mobile') {
    $conf['site_frontpage'] = variable_get('site_frontpage_mobile', variable_get('site_frontpage', 'node'));
}

but my mobile still opens the desktop frontpage. It doesn't work for me.

At least now, when I try to open directly the mobile frontpage in my desktop broser,(http://www.mysite.es/mobile-frontpage) it links to the mobile frontpage, instead of the the desktop frontpage as it used to do before trying Daniel's solution.

I had 6.x-2.3 version installed, but I removed it and re-installed "6.x-2.x-dev" version trying again Daniel's solution but it still doesn't work.

Any idea to solve it?

Thanks in Advance..

Rafa.

andrewsuth’s picture

Version: 6.x-2.3 » 6.x-2.x-dev
Status: Active » Needs review
FileSize
791 bytes

Attached is a patch which should fix this issue as well allowing different homepages to work for multilingual sites.

Patch is made against current 2.x-dev branch.

minorOffense’s picture

I'll review this evening.

minorOffense’s picture

Alright I've committed the changes in dev.

Give it a try and let me know.

Devin Carlson’s picture

Status: Needs review » Closed (duplicate)
blogers’s picture

I have the same problem