how to include mobile functionality to my website

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
mehran
Forum Newbie
Posts: 17
Joined: Fri Jan 21, 2011 1:31 am

how to include mobile functionality to my website

Post by mehran »

hello every body!
i have my term project on busines system,
i want to include the mobile functionalty to my side,
from where i start work,i completely dont know any thing about it,please help me and guide me how to work on it
thnak you
User avatar
social_experiment
DevNet Master
Posts: 2793
Joined: Sun Feb 15, 2009 11:08 am
Location: .za

Re: how to include mobile functionality to my website

Post by social_experiment »

A point to take note of is if a user will be able to view your site on their mobile device. If you get that right functionality shouldn't be a problem because the mobile's browser can handle many things that your pc browser can (html forms for example).
“Don’t worry if it doesn’t work right. If everything did, you’d be out of a job.” - Mosher’s Law of Software Engineering
Domsore
Forum Commoner
Posts: 46
Joined: Wed Jan 26, 2011 7:07 pm

Re: how to include mobile functionality to my website

Post by Domsore »

Detect if its a mobile device either using CSS (@media handheld) - http://webdesign.about.com/od/css/qt/tipcssmedia.htm OR php something like:

Code: Select all

 <? if (
 stristr($ua, "Windows CE") or
 stristr($ua, "AvantGo") or
 stristr($ua,"Mazingo") or
 stristr($ua, "Mobile") or
 stristr($ua, "T68") or
 stristr($ua,"Syncalot") or
 stristr($ua, "Blazer") ) {
 $DEVICE_TYPE="MOBILE";
 }
 if (isset($DEVICE_TYPE) and $DEVICE_TYPE=="MOBILE") {
 $location='mobile/index.php';
 header ('Location: '.$location);
 exit;
 }
 ?> 
The issue with the php way is that there are/could be many many more user agents. I would suggest the CSS method.

Bare in mind you will more it to be much more lightweight.

There's my input.. hope it helps :)
User avatar
John Cartwright
Site Admin
Posts: 11470
Joined: Tue Dec 23, 2003 2:10 am
Location: Toronto
Contact:

Re: how to include mobile functionality to my website

Post by John Cartwright »

Take a look at php-mobile-detect which is designed to detect mobile browser user agents.

See http://code.google.com/p/php-mobile-detect/
Domsore
Forum Commoner
Posts: 46
Joined: Wed Jan 26, 2011 7:07 pm

Re: how to include mobile functionality to my website

Post by Domsore »

Darn John... you always have a better solution.
josh
DevNet Master
Posts: 4872
Joined: Wed Feb 11, 2004 3:23 pm
Location: Palm beach, Florida

Re: how to include mobile functionality to my website

Post by josh »

http://tinysrc.net/

Zend Framework just added built in support, pretty cool. The only thing I can think of that you'd need to do is scale down images for "dumb phones" (non-smart phones, lol). Tiny SRC can do that. Droids/iphones can browse the full size page just fine, since they have zoom support.

The only other thing to be aware of besides that is iphone doesn't run flash, only droid. Both iphone & droid run javascript (jquery, etc.) but most other phones will not.

I prefer to use the CSS method, or just have the page use such lightweight graphics in the first place that it just runs on the phone natively in the first place. Most people with older type phones (non droid/iphone) won't browse the web very often anyways IMO.
Post Reply