Mobile Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming Languages - MoreMobile Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old September 11th, 2006, 08:00 AM
JMorjaria JMorjaria is offline
Contributing User
Dev Shed Novice (500 - 999 posts)
 
Join Date: May 2005
Posts: 538 JMorjaria User rank is Lance Corporal (50 - 100 Reputation Level)JMorjaria User rank is Lance Corporal (50 - 100 Reputation Level)JMorjaria User rank is Lance Corporal (50 - 100 Reputation Level) 
Time spent in forums: 6 Days 11 h 41 m 59 sec
Reputation Power: 4
Transforming php management site onto mobile phone

ok, I have a management site built in php and want to take some of that functionality onto a mobile phone. There is a login - then a search facility - then a results list - then a customer screen.

This is basic representation of the management site, there are lots of other bits, but this is pretty much what I want to appear. I was wondering if there was a way to see whether the user is accessing the site via a computer or a mobile device, then I can do a simple if(){ and only output the content that I want the mobile user to see.

Reply With Quote
  #2  
Old September 11th, 2006, 09:31 AM
jabba_29's Avatar
jabba_29 jabba_29 is offline
Back in HEL
Dev Shed God 8th Plane (8500 - 8999 posts)
 
Join Date: Feb 2002
Location: Finland
Posts: 8,756 jabba_29 User rank is General 10th Grade (Above 100000 Reputation Level)jabba_29 User rank is General 10th Grade (Above 100000 Reputation Level)jabba_29 User rank is General 10th Grade (Above 100000 Reputation Level)jabba_29 User rank is General 10th Grade (Above 100000 Reputation Level)jabba_29 User rank is General 10th Grade (Above 100000 Reputation Level)jabba_29 User rank is General 10th Grade (Above 100000 Reputation Level)jabba_29 User rank is General 10th Grade (Above 100000 Reputation Level)jabba_29 User rank is General 10th Grade (Above 100000 Reputation Level)jabba_29 User rank is General 10th Grade (Above 100000 Reputation Level)jabba_29 User rank is General 10th Grade (Above 100000 Reputation Level)jabba_29 User rank is General 10th Grade (Above 100000 Reputation Level)jabba_29 User rank is General 10th Grade (Above 100000 Reputation Level)jabba_29 User rank is General 10th Grade (Above 100000 Reputation Level)jabba_29 User rank is General 10th Grade (Above 100000 Reputation Level)jabba_29 User rank is General 10th Grade (Above 100000 Reputation Level)jabba_29 User rank is General 10th Grade (Above 100000 Reputation Level)  Folding Points: 57777 Folding Title: Beginner FolderFolding Points: 57777 Folding Title: Beginner FolderFolding Points: 57777 Folding Title: Beginner Folder
Time spent in forums: 3 Months 3 Weeks 6 Days 20 m 42 sec
Reputation Power: 1632
Send a message via ICQ to jabba_29 Send a message via AIM to jabba_29 Send a message via MSN to jabba_29 Send a message via Yahoo to jabba_29 Send a message via Google Talk to jabba_29 Send a message via Skype to jabba_29
Facebook
Hi,

Of course it is possible.
This thread points to a couple of methods.

The very basic idea would be something like the following ......
Create a text file with all know mobile devices' user agent strings in it
(first 4 characters) ...
Code:
known devices sample
alav
alca
armv
au-m
Open the file and create an array,
then check the UA string.
PHP Code:
<?php
  $browserfile 
'path/to/known devices sample';
  
$browsers file($browserfile);
  
# $browsers is an array already, this just tidies it up
  
foreach ($browsers as $dev) { $browserlist [] = trim($dev); } 
  
# set the variable first
  
$is_mobi false;
  if (
in_array(strtolower(substr(trim($_SERVER['HTTP_USER_AGENT']),0,4)),
  
$browserlist)) { $is_mobi  1; }

So there you have it, if the $_SERVER['HTTP_USER_AGENT'] is in the list of known devices:
$is_mobi returns true. Render content accordingly.

Are you using a pre-made CMS or self developed?
Joomla has something already that you can plug-in.
Drupal will have soon
Comments on this post
JMorjaria agrees: kl, thanks ill have a play, see what I can come up with
__________________
Cheers,

Jamie


# skiFFie | Home of the 'accessibility module' for Drupal
# Jamie Burns [me] Accessibility Module [drupal]
# guidelines | search | wap resources | not getting help | fold to cure


__________________

Let the might of your compassion arise to bring a quick end
to the flowing stream of the blood and tears .....
Please hear my anguished words of truth.



__________________

Reply With Quote
  #3  
Old September 19th, 2006, 02:27 PM
andymoo's Avatar
andymoo andymoo is offline
Timelord
Dev Shed Novice (500 - 999 posts)
 
Join Date: Oct 2003
Location: Loughborough, Leicestershire
Posts: 605 andymoo User rank is Second Lieutenant (5000 - 10000 Reputation Level)andymoo User rank is Second Lieutenant (5000 - 10000 Reputation Level)andymoo User rank is Second Lieutenant (5000 - 10000 Reputation Level)andymoo User rank is Second Lieutenant (5000 - 10000 Reputation Level)andymoo User rank is Second Lieutenant (5000 - 10000 Reputation Level)andymoo User rank is Second Lieutenant (5000 - 10000 Reputation Level)andymoo User rank is Second Lieutenant (5000 - 10000 Reputation Level) 
Time spent in forums: 4 Days 5 h 53 m 46 sec
Reputation Power: 63
the other options would include:

running some kind of tests against the content-accept variables to check for xhtml-mp, html, wml, chtml etc and also check the browser isn't IE or FF etc - only serve wml etc to devices which support it yet are not full blown web browsers.

you could also use the wurfl with wall4php then you would be able to show specific content for mobile devices as well as desktop, the wurlf though can be a tricky beast, can get it wrong and mess up so maybe a combination of the three suggestions would give you something much more solid than just any one part.
__________________
Andy Moore << oh no it's got a blog.....
Word Press WAP Plugin with Ad Mob Advertising revenue
PHP developer
deploying ringtones, mp3 downloads and realtones
I'm a geek who's obsessed with stats and gadgets

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - MoreMobile Programming > Transforming php management site onto mobile phone


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 2 hosted by Hostway