All forum admins should look: SMF 2.0 iPhone and iPod Touch Theme (NOW FREE!)

Started by farfromperfection, March 10, 2009, 11:09:28 AM

Previous topic - Next topic

~DS~

Quote from: butchs on January 02, 2010, 01:01:48 PM
The attached is a stop gap hack until the mod author does his thing.  This has been on my site for a week and seems to work ok.  It includes the fix I mentioned on the 28th and 29th.

This is not an official mod so use with caution.

Thank you, will test on my demo site.

Update: Still not working.
http://test.nathan-source.com/index.php?action=iphone

This is a screenshot from my Chrome. Works on the iPhone too but the menu on the bottom is missing on the iPhone. Anyway after that I clicked anywhere "login" or topics it automatically takes me to full site.
"There is no god, and that's the simple truth. If every trace of any single religion were wiped out and nothing were passed on, it would never be created exactly that way again. There might be some other nonsense in its place, but not that exact nonsense. If all of science were wiped out, it would still be true and someone would find a way to figure it all out again."
~Penn Jillette – God, NO! – 2011

butchs

I have been truly inspired by the SUGGESTIONS as I sit on my throne and contemplate the wisdom imposed upon me.

~DS~

"There is no god, and that's the simple truth. If every trace of any single religion were wiped out and nothing were passed on, it would never be created exactly that way again. There might be some other nonsense in its place, but not that exact nonsense. If all of science were wiped out, it would still be true and someone would find a way to figure it all out again."
~Penn Jillette – God, NO! – 2011

butchs

What about your forum forum cache at admin/Forum Maintenance/Empty the file cache?
I have been truly inspired by the SUGGESTIONS as I sit on my throne and contemplate the wisdom imposed upon me.

~DS~

Quote from: butchs on January 02, 2010, 04:11:22 PM
What about your forum forum cache at admin/Forum Maintenance/Empty the file cache?
Yes, still nothing.
"There is no god, and that's the simple truth. If every trace of any single religion were wiped out and nothing were passed on, it would never be created exactly that way again. There might be some other nonsense in its place, but not that exact nonsense. If all of science were wiped out, it would still be true and someone would find a way to figure it all out again."
~Penn Jillette – God, NO! – 2011

butchs

Could be your network cache.  The same mod seems to work here [nofollow] http://www.eastcoastrollingthunder.com/smf/index.php [nofollow]

If it works at my link for you it will work for you when your cache cleans out.
I have been truly inspired by the SUGGESTIONS as I sit on my throne and contemplate the wisdom imposed upon me.

~DS~

Quote from: butchs on January 02, 2010, 05:07:02 PM
Could be your network cache.  The same mod seems to work here [nofollow] http://www.eastcoastrollingthunder.com/smf/index.php [nofollow]

If it works at my link for you it will work for you when your cache cleans out.
It's the same issue.
When I click your topic it goes to full site.
"There is no god, and that's the simple truth. If every trace of any single religion were wiped out and nothing were passed on, it would never be created exactly that way again. There might be some other nonsense in its place, but not that exact nonsense. If all of science were wiped out, it would still be true and someone would find a way to figure it all out again."
~Penn Jillette – God, NO! – 2011

butchs

It works with [nofollow] http://iphonetester.com/ [nofollow].  I found that if cookies are not fully enabled it will not work.

I did all I can.  I can not test it like you since I do not have a real iphone.  Sorry.
I have been truly inspired by the SUGGESTIONS as I sit on my throne and contemplate the wisdom imposed upon me.

Mr. Jinx

I guess the 'action=iphone' option doesn't work as some of us expect it to work. It works for iphones, but not on other devices/browsers.
I would like to be able to use 'action=iphone' also on other devices. So the user can decide if he uses the iphone theme or not.

However, for me the best solution is still to modify load.php.
This autodetects iphone's, ipods and androids. (looks great on android!):
After:
// The theme was specified by parameter.
if (!empty($id_theme))
$id_theme = (int) $id_theme;


Add:

//IPHONE MOD
elseif (strpos($_SERVER['HTTP_USER_AGENT'], 'iPhone') !== false || strpos($_SERVER['HTTP_USER_AGENT'], 'iPod') || strpos($_SERVER['HTTP_USER_AGENT'], 'Android')) $id_theme = 8;


Remember to replace "$id_theme = 8" with the correct theme number.

Surfez Couvert

THIS MESSAGE HAS BEEN UPDATED
JANUARY 6 TH - 03H07 (GMT)
INCLUDED FILE YOO !
May I give  you my solution to have a stable 'SMS4iPhone' mod ?

I have read ALL the 15 pages of messages of this topic, and the same issue occurs for almost everyone :
either it's impossible to return to Default theme or to keep iPhone theme.

Well, I have slept only 4 hours last night to search a solution.
I don't say it's the best one, but this is the best for me :-) !

It only works with iPhone but you can modify install script it to suit to any mobile phone by changing browser agent.

Let me explain what I've done, it's very simple :

- If I'm surfing on a forum with my iPhone, it detects it and automatically use iPhone theme *WITHOUT* having to click on any 'IPHONE' button
- If I'm surfing on a forum with my desktop computer, then the theme displayed it the one recorded in my profile.

Simple and efficient !

I don't use cookie, and I don't modify all the 5 files like the orginal install.xml does. In fact, I just need the admin part where I can select the ID of the iPhone Theme.

Instead of the 'classic' button top left on the iPhone, I've replaced :
   
   $backlink = 'index.php?action=noiphone';
   (which don't really works each time)

   by :
   
   $backlink = "index.php?theme=' . $modSettings['id_theme']
   (to be SURE to ALWAYS stay on iPhone theme when I'm on iPhone).

   
INSTALLATION (archive including the 2 files at the bottom of this message) :

Install theme : SMF4iPhone_theme.zip

Install mod : SMF4iPhone_mod.zip

Select the ID of your iPhone theme (under phpMyAdmin : table smf_themes / id_theme corresponding to 'SMF4iPhone')

THEN, VERY IMPORTANT, SOME MANUAL MODIFICATIONS :

FOR *EACH* THEME INSTALLED (EXCEPT IPHONE THEME JUST INSTALLED OF COURSE), YOU MUST :

1 - OPEN FILE :

   Themes/<Name_of_the_theme>/index.template.php

2 - FIND :

   // Output any remaining HTML headers. (from mods, maybe?)
   echo $context['html_headers'];

   
3 - AFTER ADD :


    // START iPhone, iPod, Safari Mobile, Android detection
    echo '
    <script type="text/javascript">   
    if(navigator.userAgent.match(/iPhone/i) 
    || navigator.userAgent.match(/iPod/i)
    || navigator.userAgent.match(/Mobile Safari/i)
    || navigator.userAgent.match(/Android/i))
    { window.location = "index.php?theme=' . $modSettings['id_theme'] . '";}
    </script>';
    // END iPhone, iPod, Safari Mobile, Android detection


4 - VERY IMPORTANT IF YOU DON'T WANT PHP TO CRASH :
    a/ In Theme Management, select : 'Allow members to select their own themes.' (French/Français : Autoriser les membres à choisir leur propre thème)
    b/ Select the iPhone Theme.

    If you dont' do that, when surfing on iPhone, the forum will try forever to use the forbidden to use by force the iPhone theme, and the system will loop until crash.



   
And voilà ! See an exemple at my website : surfezcouvert.fr/smf/ [nofollow]

Tip : for the logo, use images/logo.jpg included, because it's well centered to make you own logo.

I hope you will understand all my explanations, because I'm french and english is not my fluent language.

Fred

By the way :  I have made french translations - included - for theme and mod.

butchs

Nice stuff.

The theme has an error?

I took the last two posts and combined them and added some minor changes:
1.  Edited load.php in an attempt to notice Android and Mobile Safari  ala "Mr. Jinx" with a twist.
2.  Moved the code into index.template.php and used it to load " Surfez Couvert's" script.
3.  Added an option to remove the iphone menu for all.

It seems to work on my simulators. Does it really work?
I have been truly inspired by the SUGGESTIONS as I sit on my throne and contemplate the wisdom imposed upon me.

Surfez Couvert

Quote from: butchs on January 05, 2010, 02:21:46 PM
Nice stuff.

The theme has an error?

I took the last two posts and combined them and added some minor changes:
1.  Edited load.php in an attempt to notice Android and Mobile Safari  ala "Mr. Jinx" with a twist.
2.  Moved the code into index.template.php and used it to load " Surfez Couvert's" script.
3.  Added an option to remove the iphone menu for all.

It seems to work on my simulators. Does it really work?

Well, someting does not work : if we are NOT connected, the theme displayed is the default one, not iPhone theme.
I try something else ......

butchs

Quote from: Surfez Couvert on January 05, 2010, 06:32:46 AM
MInstead of the 'classic' button top left on the iPhone, I've replaced :
   
   $backlink = 'index.php?action=noiphone';
   (which don't really works each time)

   by :
   
   $backlink = "index.php?theme=' . $modSettings['id_theme']
   (to be SURE to ALWAYS stay on iPhone theme when I'm on iPhone).

Did you mean to type $backlink = '?theme=' . $modSettings['id_theme'] . ';'; ?
I have been truly inspired by the SUGGESTIONS as I sit on my throne and contemplate the wisdom imposed upon me.

Surfez Couvert

Quote from: butchs on January 05, 2010, 04:18:29 PM
Quote from: Surfez Couvert on January 05, 2010, 06:32:46 AM
MInstead of the 'classic' button top left on the iPhone, I've replaced :
   
   $backlink = 'index.php?action=noiphone';
   (which don't really works each time)

   by :
   
   $backlink = "index.php?theme=' . $modSettings['id_theme']
   (to be SURE to ALWAYS stay on iPhone theme when I'm on iPhone).

Did you mean to type $backlink = '?theme=' . $modSettings['id_theme'] . ';'; ?


No no, it is not a mistake...
Well, I have tested the interesting things you've done, but I have too much problem (I mean : with REAL iPhone 3GS, maybe it works on emulator).
So, I have reinstalled my previous script (see above), which needs manual modifications, but works very well, i'm very happy (my cats too  ;) ).

However, I have developped the script to insert in each index.template.php to allow iPod (I forgot), Andropid and Safari Mobile to be detected :


1 - OPEN FILE :

Themes/<Name_of_the_theme>/index.template.php

2 - FIND :

// Output any remaining HTML headers. (from mods, maybe?)
echo $context['html_headers'];

3 - AFTER ADD :

// START iPhone, iPod, Safari Mobile, Adroid detect
echo '
<script type="text/javascript">
var agent = navigator.userAgent.toLowerCase();
var iphone = ((agent.indexOf(\'iphone\'))!=-1);
if (iphone) {window.location = "index.php?theme=' . $modSettings['id_theme'] . '";}
var iphone = ((agent.indexOf(\'ipod\'))!=-1);
if (iphone) {window.location = "index.php?theme=' . $modSettings['id_theme'] . '";}
var iphone = ((agent.indexOf(\'android\'))!=-1);
if (iphone) {window.location = "index.php?theme=' . $modSettings['id_theme'] . '";}
var iphone = ((agent.indexOf(\'safari mobile\'))!=-1);
if (iphone) {window.location = "index.php?theme=' . $modSettings['id_theme'] . '";}
</script>';
// END iPhone, iPod, Safari Mobile, Adroid detect


butchs

Interesting...  I did not think it was going to work without forcing lower case.  Your script works so I put your script back into the mod with all the new stuff.  Does the attached work?

I noticed in the iphone theme this <body', !$_GET ? ' onload="setDefaults();"' : '', '>.  As far as I know the cookie it is looking at is not used anymore.  Can this be changed to <body> to make things cleaner and work?

Quote from: Surfez Couvert on January 05, 2010, 06:32:46 AMNo no, it is not a mistake...

The theme you uploaded a few posts ago crashed.  php error.  Must have been an older version.  Could you upload the version that works on your site along with the body change: if it works?

I hope the cats do not mind?
I have been truly inspired by the SUGGESTIONS as I sit on my throne and contemplate the wisdom imposed upon me.

Surfez Couvert

Quote from: butchs
Interesting...  I did not think it was going to work without forcing lower case.  Your script works so I put your script back into the mod with all the new stuff.

The theme you uploaded a few posts ago crashed.  php error.  Must have been an older version.  Could you upload the version that works on your site along with the body change: if it works?

Well everything's okay now, I have updated my first message : http://www.simplemachines.org/community/index.php?topic=298258.msg2438737#msg2438737
With updated files too.
And updated 'user  manual'.
Don't forget the '4' :

4 - VERY IMPORTANT IF YOU DON'T WANT PHP TO CRASH :
   a/ In Theme Management, select : 'Allow members to select their own themes.' (French/Français : Autoriser les membres à choisir leur propre thème)
   b/ Select the iPhone Theme.

    If you dont' do that, when surfing on iPhone, the forum will try forever to use by force the forbidden to use the iPhone theme, and the system will loop until crash.




Oh .... There is one last problem : because users can choose iPhone theme from their profile, if they do that with a computer desktop, they won't be able to go back to classic theme, so it would be nice to create for example a new link somewhere like this : "index.php?theme=1" , but not the way it was on the first version of the mod. I will think about it....


CORRECTION JANUARY 6 TH 11:12 (GMT) :

Small correction in the iPhone Theme, just for french translation, to avoid line breaking :
languages/iPhone.language.french-utf8.php

REPLACE :
$txt['iQuoting'] = 'Citation';
$txt['iOn'] = 'Activée';
$txt['iOff'] = 'Désactivée';

WITH:
$txt['iQuoting'] = 'Citer :';
$txt['iOn'] = 'Actif';
$txt['iOff'] = 'Inactif';

~DS~

"There is no god, and that's the simple truth. If every trace of any single religion were wiped out and nothing were passed on, it would never be created exactly that way again. There might be some other nonsense in its place, but not that exact nonsense. If all of science were wiped out, it would still be true and someone would find a way to figure it all out again."
~Penn Jillette – God, NO! – 2011

Surfez Couvert

Quote from: Dismal Shadow on January 05, 2010, 09:29:48 PM
Guess I will have to wait for the stable and functionally one... :-\

The version I've made with the help of other works very well, and is more stable than the orgiginal.
I use it for my professionnal website, you don't have to worry.

CFCParadox

Just installed everything and I will test it shortly. Results will be posted here!
characters remaining: 575

butchs

Quote from: Surfez Couvert on January 05, 2010, 09:44:43 PM
Quote from: Dismal Shadow on January 05, 2010, 09:29:48 PM
Guess I will have to wait for the stable and functionally one... :-\

The version I've made with the help of other works very well, and is more stable than the orgiginal.
I use it for my professionnal website, you don't have to worry.

I had to install the mod & theme, make the "index.template.php" edits (actually I kept my last mod) and change the name of the theme from "SMF4iPhone_theme" to "theme" in my server to make it functional.

I have been truly inspired by the SUGGESTIONS as I sit on my throne and contemplate the wisdom imposed upon me.

Advertisement: