[DEV] phpBBmobile Device Browser Style

MOD Authors: Discuss and post updates on new MODs in development for phpBB3, Receive feedback and Feature requests for MODs in development.

To submit your MOD or style, go to the STG MOD Manager
Forum rules
go to the STG MOD Manager to post your MOD in development.
Discuss and receive feedback for any MOD in development for phpBB3.
Suggest features for MODs in development.

No Support or MOD Requests
-- exceptions for MODs only posted here as Beta or Alpha.
Support requests for a MOD should be requested in the respective MOD topic.

Re: [DEV] STG-Mobile Device Browser Style

Postby stitch626 » 07 Sep 2010, 21:21

Wow! Now that's what I'm talkin about. This is very slick. Lots of work but very slick.

CoC, You have really taken this style up to the next level. Great job and thank you for your contributions. I'm having a lot of fun with this on my site.
User avatar
stitch626    
STG Moderator Leader
STG Moderator Leader
 
Posts: 3185
Joined: 08 Feb 2007, 20:47
Location: Michigan
Favorite Team: Detroit Red Wings
Gender: Male
phpBB Knowledge: 7




phpBB Academy at StarTrekGuide
Support STG
Using PayPal Donate

Re: [DEV] STG-Mobile Device Browser Style

Postby CoC » 07 Sep 2010, 21:46

Glad you're liking it, just doing my bit - :good:

Something else you could try,

If you wanted the real names of phones instead of the number i.e. Blackberry 9700 (BlackBerry Bold), Blackberry 9800 (Blackberry Torch)

In the mobile detect script

add,
Code: Select all
   $real_name = '';

Before,
Code: Select all
   switch(true)


Then change,
Code: Select all
               else if (preg_match('/BlackBerry9700/i',$user_agent))
                  {
                     $status = 'BlackBerry 9700';
                  }
               else if (preg_match('/BlackBerry 9800/i',$user_agent))
                  {
                     $status = 'BlackBerry 9800';
                  }
               else if (preg_match('/BlackBerry9800/i',$user_agent))
                  {
                     $status = 'BlackBerry 9800';
                  }

With,
Code: Select all
               else if (preg_match('/BlackBerry9700/i',$user_agent))
                  {
                     $real_name = 'Blackberry Bold';
                     $status = 'BlackBerry 9700';
                  }
               else if (preg_match('/BlackBerry 9800/i',$user_agent))
                  {
                     $real_name = 'Blackberry Torch';
                     $status = 'BlackBerry 9800';
                  }
               else if (preg_match('/BlackBerry9800/i',$user_agent))
                  {
                     $real_name = 'Blackberry Torch';
                     $status = 'BlackBerry 9800';
                  }


Find,
Code: Select all
            return array($mobile_browser,$status);

Replace With,
Code: Select all
            return array($mobile_browser,$status, $real_name);

In posting.php
Replace,
Code: Select all
      $message_parser->message .= "\n\n[size=80][b][i][ Post made via " . $status[1] . "][/i][/b][/size] [img]http://www.yoursite.com/forums/images/" . $status[1] . ".png[/img]";

With,
Code: Select all
   if (empty($status[2]))
   {
      $status = $status[1];
   }
   else
      {
      $status = $status[2];
      }

      $message_parser->message .= "\n\n[size=80][b][i][ Post made via " . $status[2] . "][/i][/b][/size] [img]http://www.yoursite.com/forums/images/" . $status[1] . ".png[/img]";
User avatar
CoC    
MOD Author
MOD Author
 
Posts: 490
Joined: 23 Jan 2007, 11:09
Location: Coventry
Favorite Team: Coventry City
Gender: Male
phpBB Knowledge: 8

Re: [DEV] STG-Mobile Device Browser Style

Postby heredia21 » 08 Sep 2010, 09:03

Where do we put the blackberry browser information?
BlackBerry news come visit us!
heredia21    
Supporter
Supporter
 
Posts: 139
Joined: 10 Apr 2010, 22:15
Gender: Male
phpBB Knowledge: 4

Re: [DEV] STG-Mobile Device Browser Style

Postby heredia21 » 08 Sep 2010, 09:21

No 85xx in your list.
BlackBerry news come visit us!
heredia21    
Supporter
Supporter
 
Posts: 139
Joined: 10 Apr 2010, 22:15
Gender: Male
phpBB Knowledge: 4

Re: [DEV] STG-Mobile Device Browser Style

Postby heredia21 » 08 Sep 2010, 11:47

Heres the updated version of the BlackBerry user agents with 85xx series included:
Code: Select all

    case (preg_match('/blackberry/i',$user_agent));
            if (preg_match('/BlackBerry7100i/i',$user_agent))
               {
                  $status = 'BlackBerry 7100i';
               }
               else if (preg_match('/BlackBerry7130e/i',$user_agent))
                  {
                     $status = 'BlackBerry 7130e';
                  }
               else if (preg_match('/BlackBerry7130e/i',$user_agent))
                  {
                     $status = 'BlackBerry 7130e';
                  }
               else if (preg_match('/BlackBerry7250/i',$user_agent))
                  {
                     $status = 'BlackBerry 7250';
                  }
               else if (preg_match('/BlackBerry7230/i',$user_agent))
                  {
                     $status = 'BlackBerry 7230';
                  }
               else if (preg_match('/BlackBerry7520/i',$user_agent))
                  {
                     $status = 'BlackBerry 7520';
                  }
               else if (preg_match('/BlackBerry7730/i',$user_agent))
                  {
                     $status = 'BlackBerry 7730';
                  }
               else if (preg_match('/BlackBerry8100/i',$user_agent))
                  {
                     $status = 'BlackBerry 8100';
                  }
               else if (preg_match('/BlackBerry8130/i',$user_agent))
                  {
                     $status = 'BlackBerry 8130';
                  }
               else if (preg_match('/BlackBerry8310/i',$user_agent))
                  {
                     $status = 'BlackBerry 8310';
                  }
               else if (preg_match('/BlackBerry8320/i',$user_agent))
                  {
                     $status = 'BlackBerry 8320';
                  }
                else if (preg_match('/BlackBerry8500/i',$user_agent))
                  {
                     $status = 'BlackBerry 8500';
                  }
                    else if (preg_match('/BlackBerry8520/i',$user_agent))
                  {
                     $status = 'BlackBerry 8520';
                  }
                  else if (preg_match('/BlackBerry8530/i',$user_agent))
                  {
                     $status = 'BlackBerry 8530';
                  }
               else if (preg_match('/BlackBerry8700/i',$user_agent))
                  {
                     $status = 'BlackBerry 8700';
                  }
               else if (preg_match('/BlackBerry8703e/i',$user_agent))
                  {
                     $status = 'BlackBerry 8703e';
                  }
               else if (preg_match('/BlackBerry8820/i',$user_agent))
                  {
                     $status = 'BlackBerry 8820';
                  }
               else if (preg_match('/BlackBerry8830/i',$user_agent))
                  {
                     $status = 'BlackBerry 8830';
                  }
               else if (preg_match('/BlackBerry8900/i',$user_agent))
                  {
                     $status = 'BlackBerry 8900';
                  }
               else if (preg_match('/BlackBerry9000/i',$user_agent))
                  {
                     $status = 'BlackBerry 9000';
                  }
               else if (preg_match('/BlackBerry9530/i',$user_agent))
                  {
                     $status = 'BlackBerry 9530';
                  }
               else if (preg_match('/BlackBerry9630/i',$user_agent))
                  {
                     $status = 'BlackBerry 9630';
                  }
               else if (preg_match('/BlackBerry9700/i',$user_agent))
                  {
                     $status = 'BlackBerry 9700';
                  }
               else if (preg_match('/BlackBerry 9800/i',$user_agent))
                  {
                     $status = 'BlackBerry 9800';
                  }
               else if (preg_match('/BlackBerry9800/i',$user_agent))
                  {
                     $status = 'BlackBerry 9800';
                  }
               else
                  {
                     $status = 'BlackBerry';
                  }
               $mobile_browser = $blackberry;

            if(substr($blackberry,0,4)=='http')
            {
               $mobileredirect = $blackberry;
            }
      break;   
BlackBerry news come visit us!
heredia21    
Supporter
Supporter
 
Posts: 139
Joined: 10 Apr 2010, 22:15
Gender: Male
phpBB Knowledge: 4

Re: [DEV] STG-Mobile Device Browser Style

Postby spirit_rider » 08 Sep 2010, 16:45

Hi,

This style is very nice. But I have a small different requirement. I do not want my forum to automatically redirect to this style if a user visit the forum using mobile device. But if he visit the forum with a specific url (Example: wap.myforum.com ) then only this style should be displayed. I tried to create a subdomain and redirected to this style but if the user logout from the forum it again displays the forum's default style.

Ans this mobile device detecting script will used to add the automatic text saying post made using mobile device.

I hope some one can help me to do this.

Thanks in advance.
spirit_rider
Crewman
Crewman
 
Posts: 3
Joined: 31 Dec 2008, 23:45
Gender: Male
phpBB Knowledge: 3

Re: [DEV] STG-Mobile Device Browser Style

Postby Sniper_E » 08 Sep 2010, 16:56

heredia21 wrote:Heres the updated version of the BlackBerry user agents with 85xx series included:

Some or all of those you listed can have names, like in these codes.
Code: Select all
               else if (preg_match('/BlackBerry9700/i',$user_agent))
                  {
                     $real_name = 'Blackberry Bold';
                     $status = 'BlackBerry 9700';
                  }
               else if (preg_match('/BlackBerry 9800/i',$user_agent))
                  {
                     $real_name = 'Blackberry Torch';
                     $status = 'BlackBerry 9800';
                  }
               else if (preg_match('/BlackBerry9800/i',$user_agent))
                  {
                     $real_name = 'Blackberry Torch';
                     $status = 'BlackBerry 9800';
                  }

But your long list is better. Update that with names! ;)
I like the idea of having the phone name used.
Image
No is NEVER an Option and NEVER is the only Option when it comes to Giving Up!
User avatar
Sniper_E    
STG Jedi Master
STG Jedi Master
 
Posts: 6991
Joined: 31 May 2006, 06:29
Location: Shreveport, LA
Favorite Team: The STG Team
Gender: Male
phpBB Knowledge: 6

Re: [DEV] STG-Mobile Device Browser Style

Postby heredia21 » 08 Sep 2010, 17:04

Yeah me too. I prefer device model rather than device name. But who knows changing it up from time to time wouldnt be a bad idea.
BlackBerry news come visit us!
heredia21    
Supporter
Supporter
 
Posts: 139
Joined: 10 Apr 2010, 22:15
Gender: Male
phpBB Knowledge: 4

Re: [DEV] STG-Mobile Device Browser Style

Postby Sniper_E » 08 Sep 2010, 18:02

spirit_rider wrote:Hi,

This style is very nice. I do not want my forum to automatically redirect to this style if a user visit the forum using mobile device. But if he visit the forum with a specific url (Example: wap.myforum.com ) then only this style should be displayed. I tried to create a subdomain and redirected to this style but if the user logout from the forum it again displays the forum's default style.

And this mobile device detecting script will used to add the automatic text saying post made using mobile device.

I hope some one can help me to do this.

Thanks in advance.

After they logged out were they in wap.myforum.com or did they default back to myforum.com?

If you were using a mobile detection script, even a logged off user with a mobile would be defaulted to the mobile style.
And I guess your running another forum at wap.myforum.com with only a mobile style loaded there.

There are scripts that you can use at myforum.com that will redirect a mobile user to wap.myforum.com.
Then if a user logged out and did default back to myforum.com they would be redirected back to wap.myforum.com.
Image
No is NEVER an Option and NEVER is the only Option when it comes to Giving Up!
User avatar
Sniper_E    
STG Jedi Master
STG Jedi Master
 
Posts: 6991
Joined: 31 May 2006, 06:29
Location: Shreveport, LA
Favorite Team: The STG Team
Gender: Male
phpBB Knowledge: 6

Re: [DEV] STG-Mobile Device Browser Style

Postby stitch626 » 08 Sep 2010, 20:30

Here is a script for all the Blackberry Names. Many are redundant. I wonder if this can be shortened up. Like all the 7100 series phone are called "Smart Phone" I wonder if we could list one agent to take care of them all?

Anyway...Anyone want to test this code out? I haven't had time to gather up images. Maybe if someone has time you could make a zip file and post it here.
Code: Select all
case (preg_match('/blackberry/i',$user_agent));
                if (preg_match('/BlackBerry7100i/i',$user_agent))
                   {
                     $real_name = 'Blackberry Smart Phone';
                     $status = 'BBSmart';
                   }
                   else if (preg_match('/BlackBerry7130e/i',$user_agent))
                   {
                     $real_name = 'Blackberry Smart Phone';
                     $status = 'BBSmart';
                   }
                   else if (preg_match('/BlackBerry7130e/i',$user_agent))
                   {
                     $real_name = 'Blackberry Smart Phone';
                     $status = 'BBSmart';
                   }
                   else if (preg_match('/BlackBerry7250/i',$user_agent))
                   {
                     $real_name = 'Blackberry Smart Phone';
                     $status = 'BBSmart';
                   }
                   else if (preg_match('/BlackBerry7230/i',$user_agent))
                   {
                     $real_name = 'Blackberry Smart Phone';
                     $status = 'BBSmart';
                   }
                   else if (preg_match('/BlackBerry7520/i',$user_agent))
                   {
                     $real_name = 'Blackberry Smart Phone';
                     $status = 'BBSmart';
                   }
                   else if (preg_match('/BlackBerry7730/i',$user_agent))
                   {
                     $real_name = 'Blackberry Smart Phone';
                     $status = 'BBSmart';
                   }
                   else if (preg_match('/BlackBerry8100/i',$user_agent))
                   {
                     $real_name = 'Blackberry Pearl';
                     $status = 'Pearl';
                   }
                   else if (preg_match('/BlackBerry8130/i',$user_agent))
                   {
                     $real_name = 'Blackberry Pearl';
                     $status = 'Pearl';
                   }
                   else if (preg_match('/BlackBerry8310/i',$user_agent))
                   {
                     $real_name = 'Blackberry Pearl';
                     $status = 'Pearl';
                   }
                   else if (preg_match('/BlackBerry8320/i',$user_agent))
                   {
                     $real_name = 'Blackberry Curve';
                     $status = 'Curve';
                   }
                    else if (preg_match('/BlackBerry8500/i',$user_agent))
                   {
                     $real_name = 'Blackberry Curve';
                     $status = 'Curve';
                   }
                        else if (preg_match('/BlackBerry8520/i',$user_agent))
                   {
                     $real_name = 'Blackberry Curve';
                     $status = 'Curve';
                   }
                      else if (preg_match('/BlackBerry8530/i',$user_agent))
                   {
                     $real_name = 'Blackberry Curve';
                     $status = 'Curve';
                   }
                   else if (preg_match('/BlackBerry8700/i',$user_agent))
                   {
                     $real_name = 'Blackberry Smart Phone';
                     $status = 'BBSmart';
                   }
                   else if (preg_match('/BlackBerry8703e/i',$user_agent))
                   {
                     $real_name = 'Blackberry Smart Phone';
                     $status = 'BBSmart';
                   }
                   else if (preg_match('/BlackBerry8820/i',$user_agent))
                   {
                     $real_name = 'Blackberry Smart Phone';
                     $status = 'BBSmart';
                   }
                   else if (preg_match('/BlackBerry8830/i',$user_agent))
                   {
                     $real_name = 'Blackberry Smart Phone';
                     $status = 'BBSmart';
                   }
                   else if (preg_match('/BlackBerry8900/i',$user_agent))
                   {
                     $real_name = 'Blackberry Curve';
                     $status = 'Curve';
                   }
                   else if (preg_match('/BlackBerry9000/i',$user_agent))
                   {
                     $real_name = 'Blackberry Bold';
                     $status = 'Bold';
                   }
                   else if (preg_match('/BlackBerry9530/i',$user_agent))
                   {
                     $real_name = 'Blackberry Storm';
                     $status = 'Storm';
                   }
                   else if (preg_match('/BlackBerry9630/i',$user_agent))
                   {
                     $real_name = 'Blackberry Tour';
                     $status = 'Tour';
                   }
                   else if (preg_match('/BlackBerry9700/i',$user_agent))
                   {
                     $real_name = 'Blackberry Bold';
                     $status = 'Bold';
                   }
                   else if (preg_match('/BlackBerry 9800/i',$user_agent))
                      {
                     $real_name = 'Blackberry Torch';
                     $status = 'Torch';
                   }
                   else
                      {
                         $status = 'BlackBerry';
                      }
                   $mobile_browser = $blackberry;

                if(substr($blackberry,0,4)=='http')
                {
                   $mobileredirect = $blackberry;
                }
          break;   
User avatar
stitch626    
STG Moderator Leader
STG Moderator Leader
 
Posts: 3185
Joined: 08 Feb 2007, 20:47
Location: Michigan
Favorite Team: Detroit Red Wings
Gender: Male
phpBB Knowledge: 7

PreviousNext

Return to MODs in Development

Who is online

Users browsing this forum: No registered users and 19 guests

cron