Simple Machines Community Forum

SMF Support => SMF 2.0.x Support => Topic started by: Kevin1 on February 23, 2012, 09:27:49 AM

Title: Wap2 version for smf 2.0.2
Post by: Kevin1 on February 23, 2012, 09:27:49 AM
How to design wap2 version for my site? Or there is any mod for it?
Title: Re: Wap2 version for smf 2.0.2
Post by: geek_andy on February 23, 2012, 09:41:26 AM
If you know CSS you can change the design in "Themes/default/css/wireless.css" I believe.
Title: Re: Wap2 version for smf 2.0.2
Post by: Kevin1 on February 23, 2012, 02:25:22 PM
Bro i dont know css, is there any mod to do this work?
Title: Re: Wap2 version for smf 2.0.2
Post by: hcfwesker on February 23, 2012, 04:01:39 PM
Wap2 is already available once smf is installed.  Just check the very bottom of any page, you'll see a link 'WAP2' that can be clicked.

QuoteSMF 2.0.2 | SMF © 2011, Simple Machines
XHTML RSS WAP2
Title: Re: Wap2 version for smf 2.0.2
Post by: distante on February 23, 2012, 04:40:01 PM
Quote from: geek_andy on February 23, 2012, 09:41:26 AM
If you know CSS you can change the design in "Themes/default/css/wireless.css" I believe.

Anyone can confirm this?
Title: Re: Wap2 version for smf 2.0.2
Post by: Kevin1 on February 23, 2012, 10:54:27 PM
Quote from: hcfwesker on February 23, 2012, 04:01:39 PM
Wap2 is already available once smf is installed.  Just check the very bottom of any page, you'll see a link 'WAP2' that can be clicked.

QuoteSMF 2.0.2 | SMF © 2011, Simple Machines
XHTML RSS WAP2
yeah i know the link is available. But we have to customize the wap mode by ourself to use it....
Title: Re: Wap2 version for smf 2.0.2
Post by: Kevin1 on February 25, 2012, 06:00:59 AM
Ok I got the wap2 theme and the mod.
http://custom.simplemachines.org/themes/?lemma=2035

But, is there any other theme for wap mode??
Title: Re: Wap2 version for smf 2.0.2
Post by: pkrack on February 25, 2012, 08:08:52 AM
As far as i know, there are three themes for smf. I dont remember the urls but i can tell the names so that you can search them.
1. Curve
2.Smf4mobile
3.smf4iphone

the curve one has one benefit that its author has released  an auto switching mod, so whenever a mobile user visit your site, he will be automatically shown the curve theme, while desktop users can still enjoy your main theme.

Smf itself has three versions for handheld device.

1. Wml version at example.com?wap1

2.wap 2.0 version at example.com?wap2
3. Iphone version at example.com?imode

   i think we need a theme like gomobile created for mybb, if some one create like that, it will help us all very much, or if smf team brings a mobile theme which has registration feature, attachments capabilities and showing avators in posts, posts counts etc then it will be much help full. Because due to mobile browsers, people are able to use websites with huge pages so the mobile themes should have a twist.
Title: Re: Wap2 version for smf 2.0.2
Post by: hcfwesker on February 25, 2012, 12:57:35 PM
There's also SMF4Mobile , which is a paid theme.  I have it and it's great.  even auto-detects mobile devices.  http://smf-media.com/smf4mobile/
Title: Re: Wap2 version for smf 2.0.2
Post by: Kevin1 on February 26, 2012, 09:51:00 AM
How can I disable the wap1 theme?? I want to use wap2 theme instead of wap1. please help
Title: Re: Wap2 version for smf 2.0.2
Post by: pkrack on February 26, 2012, 12:33:05 PM
Theme can be switched via the url, use wap2 at end of url instead of wap1 . More over you can edit wap links in themes/theme_name/index.template.php folder under copyright section
Title: Re: Wap2 version for smf 2.0.2
Post by: Kevin1 on February 26, 2012, 02:32:22 PM
I know about the links, i'm asking how to completely disable the wap1 theme, and want to use wap2 theme instead of wap1
Title: Re: Wap2 version for smf 2.0.2
Post by: hcfwesker on February 26, 2012, 02:49:56 PM
You can try what I did to remove wap1 and wap2 access from my site.

in the root file  index.php

Find
if (!defined('WIRELESS'))
define('WIRELESS', isset($_REQUEST['wap']) || isset($_REQUEST['wap2']) || isset($_REQUEST['imode']));


Replace with
if (!defined('WIRELESS'))
define('WIRELESS', isset($_REQUEST['wap2']) || isset($_REQUEST['imode']));


That should remove Wap1 access.
Title: Re: Wap2 version for smf 2.0.2
Post by: pkrack on February 26, 2012, 03:06:50 PM
I dont think removing wap1 version will help in any way instead it may cause a decrease in mobile traffic. Any how as you wish
Title: Re: Wap2 version for smf 2.0.2
Post by: Kevin1 on February 27, 2012, 02:29:50 PM
Thanks. It disabled my wap1 mode. But now the browser like ucweb doesnt detecting the wap2 mode, which was previously detecting wap1 mode automatically.
Title: Re: Wap2 version for smf 2.0.2
Post by: Kevin1 on February 29, 2012, 05:49:56 AM
bump. hey please help, how to add automatic detection of wap2 mode by ucweb.
Title: Re: Wap2 version for smf 2.0.2
Post by: pkrack on February 29, 2012, 09:26:21 AM
I think instead of removing  (isset($_REQUEST['wap'])
Replace it with
isset($_REQUEST['wap2']) so you will have two wap2 parameters.and one imode, i am not php expert , i think hcfwesker can tell weather having to same parameters declared will cause error or not, if if doesnt hurt any thing, then ucweb will redirect to wap2 but remember that opera mini isnt detected as wireless and is served by web version
Title: Re: Wap2 version for smf 2.0.2
Post by: NanoSector on February 29, 2012, 02:32:07 PM
I'll research this tomorrow, you can do a dirty yet quick check with $context['browser'].
Title: Re: Wap2 version for smf 2.0.2
Post by: NanoSector on March 01, 2012, 10:57:27 AM
Okay, fiddled with this, though it won't work for an odd reason:

Before this:

// Some settings and headers are different for wireless protocols.


Add:

// Using an iPhone or Android device? Lets get something WORKING, man!
if ($context['browser']['is_iphone'] or $context['browser']['is_android'])
redirectexit($scripturl . '?wap2');
Title: Re: Wap2 version for smf 2.0.2
Post by: distante on March 01, 2012, 11:48:56 AM
When you use an android with Opera browser, that script will be able to recognize it?

I don't have an android, but I have and old E65 with opera-mini, and the wap or imode form never get showed
Title: Re: Wap2 version for smf 2.0.2
Post by: NanoSector on March 01, 2012, 12:01:20 PM
Quote from: distante on March 01, 2012, 11:48:56 AM
When you use an android with Opera browser, that script will be able to recognize it?

I don't have an android, but I have and old E65 with opera-mini, and the wap or imode form never get showed
That would require use of the $context['browser']['is_opera'] parameter, and I dunno if both [is_android'] and ['is_opera'] get set when Opera Mini is used.

Though the script doesn't work yet, it doesn't do what is expected.
Title: Re: Wap2 version for smf 2.0.2
Post by: pkrack on March 01, 2012, 02:17:25 PM
I think the reason that opera isnt served by wap version is that opera min is detected as opera (web browser). I am sorry i dont have android as my father told me that he will buy me a smart phone when i pass the entry test of medical college. So i will inform you new year :-)
Title: Re: Wap2 version for smf 2.0.2
Post by: NanoSector on March 01, 2012, 02:26:13 PM
Quote from: pkrack on March 01, 2012, 02:17:25 PM
I think the reason that opera isnt served by wap version is that opera min is detected as opera (web browser). I am sorry i dont have android as my father told me that he will buy me a smart phone when i pass the entry test of medical college. So i will inform you new year :-)
http://www.useragentstring.com/pages/Opera%20Mini/

That page tells me that Opera Mini can't be identified by OS, only by "Opera".
I have an iPod touch with Opera Mini installed, I'll check it in a moment.
Title: Re: Wap2 version for smf 2.0.2
Post by: Kevin1 on March 02, 2012, 12:33:42 AM
Bro i want to redirect ucweb browser to wap2 mode..
Title: Re: Wap2 version for smf 2.0.2
Post by: pkrack on March 02, 2012, 06:28:01 AM
Oh sorry, your problem got covered in our discussion. So have you changed wap to wap2 i.e not deleting them but changing them . Another idea which sprang up in my mind is that you can edit wireless.template.php and in section declared as wap1 , change the css file path to wap2 css . I think it will work if both css have classes with same name and if a single css file is called by both versions then then it wouldnt work.
Title: Re: Wap2 version for smf 2.0.2
Post by: Kevin1 on March 02, 2012, 06:43:41 AM
Please tell me the complete procedure...
Title: Re: Wap2 version for smf 2.0.2
Post by: Kevin1 on March 04, 2012, 11:03:29 AM
hello please help...
Title: Re: Wap2 version for smf 2.0.2
Post by: pkrack on March 04, 2012, 11:21:15 PM
So here is the wap code in index.php // Determine if this is
using WAP, WAP2, or
imode. Technically, we
should check that wap
comes before
application/xhtml or
text/html, but this
doesn't work in practice
as much as it should.
if (isset($_REQUEST
['wap']) || isset
($_REQUEST['wap2']) ||
isset($_REQUEST
['imode']))
unset($_SESSION
['nowap']);
elseif (isset($_REQUEST
['nowap']))
$_SESSION['nowap'] =
true;
elseif (!isset($_SESSION
['nowap']))
{
if (isset($_SERVER
['HTTP_ACCEPT']) &&
strpos($_SERVER
['HTTP_ACCEPT'],
'application/
vnd.wap.xhtml+xml') !==
false)
$_REQUEST['wap2'] = 1;
elseif (isset($_SERVER
['HTTP_ACCEPT']) &&
strpos($_SERVER
['HTTP_ACCEPT'], 'text/
vnd.wap.wml') !==
false)
{
if (strpos($_SERVER
['HTTP_USER_AGENT'],
'DoCoMo/') !== false ||
strpos($_SERVER
['HTTP_USER_AGENT'],
'portalmmm/') !==
false)
$_REQUEST['imode'] = 1;
else
$_REQUEST['wap'] = 1;
}
}
if (!defined('WIRELESS'))
define('WIRELESS', isset
($_REQUEST['wap']) ||
isset($_REQUEST
['wap2']) || isset
($_REQUEST['imode']));

     i copied it so that if some buddy dont know about the code but still is an expert , can help you. I dont think its related with $_request[wap] in first kind as it works when some body use wap in url, i think all the work is done by if (strpos($_SERVER
['HTTP_USER_AGENT'],
'DoCoMo/') !== false ||
strpos($_SERVER
['HTTP_USER_AGENT'],
'portalmmm/') !==
false)
$_REQUEST['imode'] = 1;
else
$_REQUEST['wap'] = 1;
so if we change $_REQUEST['wap'] to $_REQUEST['wap2'] in the second code then it might work.
          One thing you should do is to create a copy of index.php with some other name and do all experiments there, as no body is perfect and some time a very simple code can cause huge problems for you. So if some thing gets wrong , your site will still be safe 
Title: Re: Wap2 version for smf 2.0.2
Post by: Kevin1 on March 06, 2012, 05:26:57 AM
Ok problem solved..
I have replaced
Quoteif (isset($_REQUEST['nowap']))
   $_SESSION['nowap'] = true;
elseif (!isset($_SESSION['nowap']))
{
   if (isset($_SERVER['HTTP_ACCEPT']) && strpos($_SERVER['HTTP_ACCEPT'], 'application/vnd.wap.xhtml+xml') !== false)
      $_REQUEST['wap2'] = 1;
   elseif (isset($_SERVER['HTTP_ACCEPT']) && strpos($_SERVER['HTTP_ACCEPT'], 'text/vnd.wap.wml') !== false)
   {
      if (strpos($_SERVER['HTTP_USER_AGENT'], 'DoCoMo/') !== false || strpos($_SERVER['HTTP_USER_AGENT'], 'portalmmm/') !== false)
         $_REQUEST['imode'] = 1;
      else
         $_REQUEST['wap'] = 1;
   }

}

with

Quote
if (isset($_REQUEST['nowap']))
   $_SESSION['nowap'] = true;
elseif (!isset($_SESSION['nowap']))
{
   if (isset($_SERVER['HTTP_ACCEPT']) && strpos($_SERVER['HTTP_ACCEPT'], 'application/vnd.wap.xhtml+xml') !== false)
      $_REQUEST['wap2'] = 1;
   elseif (isset($_SERVER['HTTP_ACCEPT']) && strpos($_SERVER['HTTP_ACCEPT'], 'text/vnd.wap.wml') !== false)
   {
      if (strpos($_SERVER['HTTP_USER_AGENT'], 'DoCoMo/') !== false || strpos($_SERVER['HTTP_USER_AGENT'], 'portalmmm/') !== false)
         $_REQUEST['imode'] = 1;
      else
         $_REQUEST['wap'] = 1;
   }
   elseif(preg_match('/Opera Mini/i',$_SERVER['HTTP_USER_AGENT']))
                               $_REQUEST['wap2'] = 1;
}

Now ucweb is automatically detecting wap2 mode..

thanks all
Title: Re: Wap2 version for smf 2.0.2
Post by: pkrack on March 06, 2012, 07:18:37 AM
Thanks God. Your simple but yet complicated problem got solved