Nao

  • Dadman with a boy
  • Messages: 16 082
Re: Mobile Version
« Réponse #15, le 6 Juin 2012 à 11:46 »
Oh yeah, forgot to suggest logging off :)

ziycon

  • Messages: 126
APRAI - Custom Theme - SMF 2.0.5


Dragooon

  • I can code! Really!
  • polygon.com has to be one of the best sites I've seen recently.
  • Messages: 1 841
The way it's meant to be

Nao

  • Dadman with a boy
  • Messages: 16 082
Re: Mobile Version
« Réponse #18, le 6 Juin 2012 à 11:50 »
Yup... And/or log out ;)

ziycon

  • Messages: 126
Re: Mobile Version
« Réponse #19, le 6 Juin 2012 à 12:46 »
Cleared everything I could possible clear and logged out and back in, still the same. <_<

Nao

  • Dadman with a boy
  • Messages: 16 082
Re: Mobile Version
« Réponse #20, le 6 Juin 2012 à 13:09 »
It's no fun anymore. :(

Dragooon

  • I can code! Really!
  • polygon.com has to be one of the best sites I've seen recently.
  • Messages: 1 841
Re: Mobile Version
« Réponse #21, le 6 Juin 2012 à 13:20 »
Code: (Class-MoDe.php) [Sélectionner]
if (strpos($ua, $device) !== false)
return true;
Shouldn't that be
Code: (Replace) [Sélectionner]
if (preg_match('/' . $device . '/i', $ua))
return true;
?

Plus I don't see samsung/bada in there?
Posté : 6 Juin 2012 à 13:16

Crap, no. Didn't read the foreach declaration.

Nao

  • Dadman with a boy
  • Messages: 16 082
Re: Mobile Version
« Réponse #22, le 6 Juin 2012 à 13:21 »
Citation de Dragooon le 6 Juin 2012 à 13:16
Code: (Class-MoDe.php) [Sélectionner]
if (strpos($ua, $device) !== false)
return true;
Shouldn't that be
Code: (Replace) [Sélectionner]
if (preg_match('/' . $device . '/i', $ua))
return true;
?
No... This is an array of short strings that are lowercased, and the user agent is lowercased at this point, too. There's no point in wasting time compiling a regex for that. I'm just scanning the user agent for these strings. It could be faster to do a global regex match for the entire list of devices, but I did some tests earlier and it was actually slower... (Yes, a single preg_match was slower than dozens of strpos calls...)
Maybe it has changed since I did my first tests, but I doubt so.
Citation
Plus I don't see samsung/bada in there?
Because it's not committed yet. Currently on wedge.org there's an additional '|samsung|' in the 'generic' list. It should return 0 for ziycon (start of the string), which is !== false (but not != false of course), and thus should return true overall...

Dragooon

  • I can code! Really!
  • polygon.com has to be one of the best sites I've seen recently.
  • Messages: 1 841
Re: Mobile Version
« Réponse #23, le 6 Juin 2012 à 13:22 »
It is case sensitive. samsung won't match anything as it's SAMSUNG (strpos is case sensitive, stripos isn't).

Nao

  • Dadman with a boy
  • Messages: 16 082
Re: Mobile Version
« Réponse #24, le 6 Juin 2012 à 14:18 »
Look at the strtolower............. :whistle:

Dragooon

  • I can code! Really!
  • polygon.com has to be one of the best sites I've seen recently.
  • Messages: 1 841
Re: Mobile Version
« Réponse #25, le 6 Juin 2012 à 14:26 »
What the f....I got no idea why that won't work.

Nao

  • Dadman with a boy
  • Messages: 16 082
Re: Mobile Version
« Réponse #26, le 6 Juin 2012 à 14:38 »
Hence my original reply...

Perhaps it always worked for him, but he chose to go Weaving at some point during his mobile tests, and I can't do anything for him...
But if he's logged out (a guest), and has cookies disabled, then it SHOULD work...

Dragooon

  • I can code! Really!
  • polygon.com has to be one of the best sites I've seen recently.
  • Messages: 1 841
Re: Mobile Version
« Réponse #27, le 6 Juin 2012 à 14:44 »
Did a test run using that UA, code is evaluating it fine (after adding |samsung|). So must be something else.

Nao

  • Dadman with a boy
  • Messages: 16 082

ziycon

  • Messages: 126
Re: Mobile Version
« Réponse #29, le 6 Juin 2012 à 16:55 »
The only other thing I can think of is that the mobile site is being applied but it doesn't like working with my device, can you post a screen of what the mobile site should look like?!