Recent Topics

1 Mar 24, 2009 01:46    

My b2evolution Version: 2.x

Ok, after glancing through different posts on the site looking for a way to create a mobile skin and finding none that would help me, I stumbled across a way to make a mobile skin work.

This may be elementary for most of you but for other noobs like me I thought I'd go ahead and post it.

First, you need to get the code to detect a mobile browser from this site:
http://detectmobilebrowsers.mobi/#support

You'll need to download the php file mobile_device_detect.php and put it in the root of your blog.

Next, use the function generator from that site to generate the function you'll need. You can specify which mobile browsers to treat as mobile versus desktop. You also have the option to direct mobile and/or desktop browsers to a different url if you want, otherwise the function will return true for mobile and false for desktop.

In my case, I chose to treat IPhone and Andriod (webkit browsers) as desktop, and all other mobile browsers as mobile. I didn't choose to forward either, so I get a true or false from the function.

Here is the code I ended up with:

include('mobile_device_detect.php');
mobile_device_detect(false,false,true,true,true,true,false,false);

Ok, now you need to decide what skin to use for your mobile browsers. It should probably be minimalistic - I'm using asevo to start with and then I'll customize it to suit me. The basic asevo skin works well, though, as is.

Once you get the skin finished, or at least working, you need to add the code to your site.

First, you'll need to add the code to your index.php file in the root of your blog. Look for this code:

# You could *force* a specific skin here with this setting:
# $skin = 'basic';

Replace that code with:

# You could *force* a specific skin here with this setting:
include('mobile_device_detect.php');
if( mobile_device_detect(false,false,true,true,true,true,false,false) )
{
 $skin = 'asevo';
}


You'll replace "asevo" with the name of the skin you want to use.

This will load this skin for mobile browsers whenever you load the homepage or hit links on the site that use extra params or paths added to the index.php stub.

If your blogs are relative to baseurl, which mine were, then you'll need to edit the stub files for each blog. In my case, they were blog1.php, blog2.php, etc. In each file, look for:

# You could *force* a specific skin here with this setting: (otherwise, default will be used)
# $skin = 'custom';

and replace it with the code from above.

If you use subdomains or absolute url's then you will need to add the code to whatever stub file loads that blog. I assume it will be index.php in that subdomain's or absolute url's root folder. Also, you will need to either place the mobile_device_detect.php file in the root folder as well, or change the code to point to an absolute url for the file.

My site is www.alexandheather.net

Please take a look with your mobile phone if you want and let me know if there are any problems or pages that don't load with the asevo skin. I haven't modded it yet, but will as I go along.

Also, if I've made any incorrect assumptions, please let me know.

Thanks.

2 Mar 24, 2009 02:02

Via my iPhone and it's Safari browser...
Your left side grey border image (shaderight.png) sits over the the right side menu from the cats tail to the bottom..
Other than that it seems fine.
It may the fact that the left border image carries the same name as the right image !!! Not sure.

3 Mar 24, 2009 02:52

John wrote:

Via my iPhone and it's Safari browser...
Your left side grey border image (shaderight.png) sits over the the right side menu from the cats tail to the bottom..
Other than that it seems fine.
It may the fact that the left border image carries the same name as the right image !!! Not sure.

Never viewed it from safari on an IPhone before. I assumed that the webkit browsers would display the css stuff correctly, but I guess not.

I think, after I get the mobile version tweaked, that I'll set up a third skin for Iphone and Android browsers. Closer to a desktop skin, but a lot less css going on.

Thanks for the reply.

4 Mar 24, 2009 02:57

There is some odd behaviour with my site on iPhone Safari as well.
My "info" link, which is a page bottom link, works fine but the related "Page Top" link fails every time.
.


Form is loading...