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

butchs

Sorry.  Please uninstall that old MOD asap.  I assumed you were going to replace that version with the new version.  That bug was fixed yesterday in version 2.7.1:

http://www.simplemachines.org/community/index.php?topic=298258.msg2447703#msg2447703


The new version includes a filter that will read a user agent and pick one of three themes.  If a user agent is not found all mobile devices (thanks to detectfree) will go to the failsafe theme WAP2 or a theme you specify.

The selection boxes are text boxes.  So you not put spaces in the theme ID box.  Plus if you have some selective mobile themes installed  before you install the mod it will try to pick the theme ID and select some user agents for the theme.  The user agents I selected may or may not go with that theme.
???

I checked this one the best I can and  moved it out of the test forum.  I think it is stable???
I have been truly inspired by the SUGGESTIONS as I sit on my throne and contemplate the wisdom imposed upon me.

doughboy99

Hi

I'm getting errors such as the following when accessing topics


8: Undefined variable: category

File: /xxxxx/forum/Themes/theme/MessageIndex.template.php (main sub template - eval?)
Line: 38


Appears to be related to this piece of code in the themes boardindex.template.php

foreach ($board['children'] as $child)
{

$children=true;

echo '
<li class="child', (!$child['new']&&$context['user']['is_logged']) ? ' off' : '', '">
<a href="', $child['href'], '"', $i==count($category['boards']) ? ' class="last"' : '' ,'>', $child['name'],'
<div class="description">', $txt['last_post'], ' ', $child['last_post']['time']=='N/A' ? $txt['no'] . ' ' . $txt['topics'] : iPhoneTime($child['last_post']['timestamp']) . ' ' . $txt['by'] . ' ' . $child['last_post']['member']['name'],
'</div></a>
</li>
';


Does anyone have any idea what might resolve this.

~DS~

Weird it didn't work.

EDIT: Weird it works on my test site. Maybe something wrong I did.
"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

The code is the same as 2.5.2 but I added a filter that if there was not match it will fall through to the failsafe.  Remember we added a session so that it will only do it once.

I went back to my test server and tried to force it and it did not work until I removed the PHPESSID cookie from my website.  Once the cookie was removed it worked on my server.  So please try to remove the cookie named PHPESSID from your test site.
I have been truly inspired by the SUGGESTIONS as I sit on my throne and contemplate the wisdom imposed upon me.

~DS~

Doesn't work either on my site and test site IF you login. Works fine without login. If you login...it will go to full version.
"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

That does not sound like a mod issue.  That sounds like a theme issue.

When you log in the login script transfers you to your default theme as identified by the user in the database.  It is nearly impossible for me guess who is online and assign them their theme id.

Now, if you log in and delete your PHPESSID cookie the mod should transfer you to the mobile theme.

You can start with he load.php file???
I have been truly inspired by the SUGGESTIONS as I sit on my throne and contemplate the wisdom imposed upon me.

butchs

Try searching the "index.template.php" of the SMF4iphone theme for:
if((!empty($_GET['action'])) && (($_GET['action']=='login') || ($_GET['action']=='register')))
$loginregister=' style="display:none;"';


and replace it with:
if((!empty($_GET['action'])) && (($_GET['action']=='login') || ($_GET['action']=='register'))) {
$loginregister=' style="display:none;"';
unset($_SESSION['smf4iphone']); }


The above will reset the SMF4iphone session during login and let the mod find the correct theme.

I am sure someone else knows a better way.
I have been truly inspired by the SUGGESTIONS as I sit on my throne and contemplate the wisdom imposed upon me.

butchs

No news is good news. I believe i am done here and Fabius85 can take over.

I can co-author for the mod.  But, I can not support it 100%

I did little on the theme.  Surfez did more work there.

Both of them may be good enough to send to SMF for approval?

The mod uses the Movila Free Device detection which is a free server that detects wether or not you are using a mobile device.  This service takes some of the problems out of the picture.  Not only will it check just the user agent but it will check domain names that are used for mobile devices.  The web site clams it is more reliable and it is free!!

The mod includes a filter that will read a user agent and pick one of three themes.  If a user agent is not found all mobile devices (thanks to detectfree) will go to the failsafe 4th theme WAP2 or a theme you specify.  See the attached picture.

If you have the "iphone", "curve_mobile" and "mobile_theme"'s installed before you load the mod.  The mod will detect them and assign them as follows:

Theme # 1:      smf4iphone
with user agents for "iphone|ipod|android|mobile|Safari Mobile"

Theme # 2:      curve_mobile
with user agents for "iemobile|Opera Mobi|symbian|series60|series70|series80|series90|series 60|series 70|series 80|series 90|blackberry|blackberry05|palm|webos"

Theme # 3:      mobile_theme
with user agents for "ipnokia|motorola|samsung|fennec|minimo|sonyericsson|htc"

failsafe theme:  WAP2
all remaining user agents

If any of the above themes are missing the mod will leave the theme ID blank.  If either row is blank the theme will be skipped.  Please note that the user agents selected are merely a guess and should be adjusted for the theme best fit.

The selection boxes are text boxes so be careful.

Quote from: Surfez Couvert on January 05, 2010, 06:32:46 AM
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.

Changes:
Theme
1.  Tried to fix category error.
2.  Fixed login theme transfer error.
3.  Fixed Classic transfer error.
4.  Some minor bugs.

Mod
1. Fixed some minor eval bugs.

Jan 15, 09 - theme was edited - Added "doughboy99"'s suggestion for theme version.

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

~DS~

Perfect, seem to work this time.
I have few problems:

1)After I click "classic" how do I get back to iPhone mode(theme)? Of course, clear cookie and cache. iPhone button should be there just in case.

2)Looking for a walkaround for portal (mine us SimplePortal) since it messed up with the iPhone theme unless it's disabled.

Requests, would like to see more features of what this mod can do.

"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

doughboy99

amend the themes index.template.php to disable portals when it loads(this is how it is done in the excellent curve-mobile theme). This won;t work for EZportal which doesn't have the option to disable as far as I know.

Change
function template_init()
{
global $context, $settings, $options, $txt;

$settings['theme_version'] = '1.0';
}


To

function template_init()
{
global $context, $settings, $options, $txt;

$settings['theme_version'] = '1.0';

// Portal disabling mafia
// SimplePortal
$settings['disable_sp'] = true;

// TinyPortal
if (function_exists('tp_hidebars'))
tp_hidebars();

// PortaMX
$_SESSION['pmx_paneloff'] = array('head', 'top', 'left', 'right', 'bottom', 'foot', 'front', 'pages' => 'Pages');
}


~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

doughboy99

Don't think RC2 is an issue. I am using this code in my RC forums with a couple of theme I dont want SimplePortal to appear on.

~DS~

Quote from: doughboy99 on January 15, 2010, 05:53:30 AM
Don't think RC2 is an issue. I am using this code in my RC forums with a couple of theme I dont want SimplePortal to appear on.
If it works for you then it should work as this is the only way to bypass the portals. Hopeful someone can upgrade your code for 2.0 RC2.
"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

doughboy99

Sorry I miss typed there. I AM using SMF2 RC2 and this code works for me.

~DS~

Obviously it doesn't work as I have tried. It still shows portal.
"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

doughboy99

Are you changing the SMF4iphone index.template.php? If you change the one for the default theme then you will disable portals for that theme.

$settings['theme_version'] = ... was never changed in the SMF4iPhone theme index.template.php when it was wriiten for SMF 2

~DS~

Yeah, just figured it out. My bad. It works now. Thanks. It should be added to the mod. Good job.
"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 modified the theme as per doughboys suggestion.  See above.

Quote from: Dismal Shadow on January 14, 2010, 10:50:23 PM
Perfect, seem to work this time.
I have few problems:

1)After I click "classic" how do I get back to iPhone mode(theme)? Of course, clear cookie and cache. iPhone button should be there just in case.

type www.yoursite.com/smf/index.php?theme=#,
Where # is your theme ID.

Or you can modify your default theme with a selection at the bottom next to WAP2. Something like:
<a href="'http://www.yoursite.com/smf/index.php?theme=' . $modSettings['id_theme1']; >use the default theme</a>

Assuming iphone is the 1st theme in the list.

Quote from: Dismal Shadow on January 14, 2010, 10:50:23 PM
Requests, would like to see more features of what this mod can do.

The mod can transfer to curve mobile or any other theme based on the phrases entered in the modification settings. I suggest you copy the built in phrases.  Save them to a safe place and give it a try.  If everything works right you should be able to send someone to any theme based on the phrases.  Adding a new UA is as simple as typing in a new phraise.  Please note that SMF does have a default transfer to WAP2 in load.php.  Since this is first it will override the mod at times.

If either the theme ID or the phrase is blank that theme will be skipped.

I envision code statements with cut and paste theme phrases or User Agents for themes that are specially designed for a particular device.

Other than that, guys like you will need to test it.  I do not have a mobile device.
I have been truly inspired by the SUGGESTIONS as I sit on my throne and contemplate the wisdom imposed upon me.

butchs

Oh I reread "Dismal Shadow"'s question.  I am not sure what to do with the "iPhone button".  It can be an optional menu but then what do you do about the other 2 themes?  Do you make it for admin only or for all members.  Should it be a button or should it be a link at the bottom.  Some like it, some do not, that is why I suggested a manual link addition to the default theme.
:o
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 15, 2010, 08:03:22 PM
Oh I reread "Dismal Shadow"'s question.  I am not sure what to do with the "iPhone button".  It can be an optional menu but then what do you do about the other 2 themes?  Do you make it for admin only or for all members.  Should it be a button or should it be a link at the bottom.  Some like it, some do not, that is why I suggested a manual link addition to the default theme.
:o
Of course it should be optional and can either be enable or disabled from the Modification Settings because I am not the only one who will be using this feature alone some of my user have iPhone so there should be a botton intead of telling my user to do index.php?theme=
"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

Advertisement: