In latest dev version, alternate mobile front page view no longer works.

Details: I have created a derivative of the front page view (edited system "frontpage" view) with a URL of /mobile. The mobile view consists of titles only, as opposed to teasers. This works well in 2.1, but in the latest dev, the mobile front page doesn't switch the view. Going to URL/mobile displays correctly.

Mobile tools weight is set to 100, so it's not a weight issue, I don't think.

As a BTW, the two other issues I had (with Administrative Theme and CCK image display) look like they're solved (hooray!), so it looks like there's just this last issue for me before being able to go mobile. Thanks to Tom for all the great work he's doing here!

Comments

twom’s picture

hi bcobin,

I just committed the fix for the frontpage problem to the dev version! It was caused by my refactoring two weeks ago... You can get it from cvs or wait for the new dev build!

Tom

twom’s picture

Assigned: Unassigned » twom
Status: Active » Needs review
bcobin’s picture

Thanks, Tom - tried the new (1/24) dev and behavior is unchanged when it comes to the front page view, unfortunately.

De-installed, re-installed, cleared caches - everything I could think of. Any ideas? Thanks!

twom’s picture

Hmmm... I see, it is indeed not working.
I fixed it by putting the configuration of the frontpage in hook_boot().

It should be ok now...

emartos’s picture

Hi there!

I'm trying Mobile Tools module (amazing work!) but the frontpage feature is not working at all: my mobile frontpage was never displayed, but I think I've found a workaround:

mobile_tools.module [line 150]:

  // Some small extras 
  if (mobile_tools_is_mobile_site() == 'mobile' || $theme_switched) {
    $conf['default_nodes_main'] = variable_get('default_nodes_main_mobile', variable_get('default_nodes_main', 10));
    $conf['site_frontpage'] = variable_get('site_frontpage_mobile', variable_get('site_frontpage', 'node'));
    $_GET['q'] = drupal_get_normal_path(variable_get('site_frontpage_mobile', variable_get('site_frontpage', 'node')));
  }

I took this line

$_GET['q'] = drupal_get_normal_path(variable_get('site_frontpage_mobile', variable_get('site_frontpage', 'node')));

from includes/path.inc and now the frontpage feature is working fine.

Hope this helps!

emartos’s picture

No, it's not a fix. This workaround causes a continuous redirect to the mobile home page, making navigation impossible.

Anyway, there should be a fix because it's not working at all.

emartos’s picture

Ok, I think I've found a new workaround:

  if (mobile_tools_is_mobile_site() == 'mobile' || $theme_switched) {
    $conf['default_nodes_main'] = variable_get('default_nodes_main_mobile', variable_get('default_nodes_main', 10));
    $conf['site_frontpage'] = variable_get('site_frontpage_mobile', variable_get('site_frontpage', 'node'));
    if (!empty($_GET['q'])) {
      if(drupal_is_front_page($_GET['q'])) {
        $_GET['q'] = drupal_get_normal_path($conf['site_frontpage']);
      } else {
        $_GET['q'] = drupal_get_normal_path(trim($_GET['q'], '/'));
      }
    }
    else {
      $_GET['q'] = drupal_get_normal_path($conf['site_frontpage']);
    }
  } 

Could you please validate this fix? I know it's not the best solution, but now it's working.

Thank you in advance!

bcobin’s picture

As far as the alternate front page view (the original topic of this thread), this is working on my system - so I'd say this is fixed. As far as automatic redirection is concerned, though, I can't yet fully test it - although I do see evidence there may be a problem.

The site I'll be using this on (we start with one) now exists in my sandbox and on IP. So I can't test it on the web until we change the DNS to point to the new site.

In the sandbox, I'm internally redirecting domain name resolution to the site folder using MAMP Pro. http://m.[site].com and http://[site].com both work as expected with automatic redirection off.

However, when I turn on automatic redirection, the iPhoney (which is what I'm using to test) goes to the web and isn't redirected internally. This isn't right, but it could be interaction between the module and MAMP Pro - I can't really test this until we go "live" on the new site.

So the first thing I'd do is to look at how things work with redirection off; this may help to track things down.

I'll check back in as soon as we launch, which on this site won't be until March. However, there are other sites I'm doing that will likely be launched before then; I will report back.

Hope this helps at least a little!

bcobin’s picture

Well, we've "soft launched" and the redirection is working fine, AFAICT. Good work!

There's a different problem, though, and I'll open up a separate thread (I haven't seen it here): When the user goes to view the full page (link is "http://[my site].com?mobile=false"), the URL changes briefly, but immediately reverts to m.URL - so it's not possible to view the full site with automatic redirection turned on.

I've tried setting the cookie to 0 - no difference. I'll leave the thread as is - others might be having a different problem - thanks, twom!

twom’s picture

Status: Needs review » Fixed

The homepage problem should be fixed in the dev release and forcing a certain version of the site is replaced by the ?device= ... directive.

Closing this thread, unless somebody experiences problems (but maybe then a new thread can be started :))

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

kentr’s picture

Version: 6.x-2.x-dev » 6.x-2.4
Status: Closed (fixed) » Needs work

Not fixed in 6.x-2.4

This fixes it under my current environment. Many apologies, no time to create a patch right now.

Change mobile_tools.module, line 225

from

if ($mobile_tools_device == 'mobile' and mobile_tools_site_type() == 'mobile') {

to

if ($mobile_tools_device['type'] == 'mobile' && mobile_tools_site_type() == 'mobile') {

devin carlson’s picture

Version: 6.x-2.4 » 6.x-2.x-dev
Component: Miscellaneous » Code
Assigned: twom » devin carlson
Status: Needs work » Needs review
StatusFileSize
new558 bytes

#12 looks reasonable to me. A patch to implement the change.

devin carlson’s picture

Status: Needs review » Fixed

Committed to 6.x-2.x.

aze2010’s picture

Version: 6.x-2.x-dev » 6.x-2.6

Sorry, but it is still not working at me.

Using latest Drupal 6 and latest (non dev) mobile Tools 2.6.

My mobile Page screws up with endless redirection but not to the setted mobile-frontpage.

Any solutions or hints?

Update:
I just found out, when i activate automatic redirection with cookies, the whole redirection screws up in a loop.

Why?

yllus’s picture

I too was having problems with version 6.x-2.6 and solved it. I traced the issue to this line in mobile_tools_boot():

if ($mobile_tools_device['type'] == 'mobile' && mobile_tools_site_type() == 'mobile') {

The problem was now that mobile_tools_site_type() was never returning the correct value. The problem here appears to be that the entire mobile_tools_site_type() function as it is currently written is incorrect - it wants to load the module saved to the Drupal variable mobile-tools-site-type-detection, but no such value is ever saved in the module (or its admin pages).

The solution appears quite straightforward - the function to return whether or not the site visitor is on the mobile site is in mobile_tools.module itself as mobile_tools_is_mobile_site(). So, finally, simply replace the function mobile_tools_site_type() with:

/**
 * Determine the current site type.
 *
 * @return string
 *   A string, either 'desktop' or 'mobile', representing the current site type.
 */
function mobile_tools_site_type() {
  static $site_type;

  $site_type = mobile_tools_is_mobile_site();
  
  return $site_type;
}

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.