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 May 9th, 2007, 01:18 PM
marf marf is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Mar 2003
Posts: 74 marf User rank is Sergeant (500 - 2000 Reputation Level)marf User rank is Sergeant (500 - 2000 Reputation Level)marf User rank is Sergeant (500 - 2000 Reputation Level)marf User rank is Sergeant (500 - 2000 Reputation Level)marf User rank is Sergeant (500 - 2000 Reputation Level) 
Time spent in forums: 4 h 20 m 17 sec
Reputation Power: 12
WAP WML, and PHP

Ok. First off I'd like to call myself above intermediate with PHP and MySQL (html css and all of that is implied). And I have encountered a task, where I have a dynamic version of a single page, that I need to also have a simple WAP version (an old Grayscale mobile device), will perform the same fetches from a MySQL database with PHP, and I want it to display to the WAP browser (via wml?). My problem is I am following this tutorial

http://www.developer.com/lang/php/article.php/10941_1449061_1

page 1 and 2 go smoothly (I'm using PHP 4.3.x MySQL 5.xx and IIS 6.0 i believe). I added the php.exe to the wml extension as per instructed on page 2 of that tutorial. I then make a test.wml with

PHP Code:
<?php

header
("Content-type: text/vnd.wap.wml");  

print 
"<?xml version=\"1.0\"?>\n";  
print 
"<!DOCTYPE wml PUBLIC \"-//WAPFORUM//DTD WML 1.1//EN\""  
   
" \"http://www.wapforum.org/DTD/wml_1.1.xml\">\n"
   
print 
"<wml>\n";
print 
"<card>\n";
print 
"<p>Hello world</p>\n";
print 
"</card>\n";
print 
"</wml>\n";

?>


That works and I can see it.

However I don't want it to be http://www.mysite.com/test.wml

I want to have it http://www.mysite.com

which ofcourse loats index.php
and within index.php it could have

PHP Code:
 $usr_agent strtolower($_SERVER['HTTP_USER_AGENT']);
    
if((
strpos($usr_agent,"blackberry") === true){
//They need wml for these WAP devices

} else{
//Its a pc



But whenever i try to go to index.php through the wap browser on the mobile device, I get Error 406, Not Acceptable "Page not loaded because browser doesn't support"

Any Ideas/Help PLEASE.

Reply With Quote
  #2  
Old May 11th, 2007, 06:09 AM
jabba_29's Avatar
jabba_29 jabba_29 is offline
Back in HEL
Click here for more information.
 
Join Date: Feb 2002
Location: Finland
Posts: 8,910 jabba_29 User rank is General 11st Grade (Above 100000 Reputation Level)jabba_29 User rank is General 11st Grade (Above 100000 Reputation Level)jabba_29 User rank is General 11st Grade (Above 100000 Reputation Level)jabba_29 User rank is General 11st Grade (Above 100000 Reputation Level)jabba_29 User rank is General 11st Grade (Above 100000 Reputation Level)jabba_29 User rank is General 11st Grade (Above 100000 Reputation Level)jabba_29 User rank is General 11st Grade (Above 100000 Reputation Level)jabba_29 User rank is General 11st Grade (Above 100000 Reputation Level)jabba_29 User rank is General 11st Grade (Above 100000 Reputation Level)jabba_29 User rank is General 11st Grade (Above 100000 Reputation Level)jabba_29 User rank is General 11st Grade (Above 100000 Reputation Level)jabba_29 User rank is General 11st Grade (Above 100000 Reputation Level)jabba_29 User rank is General 11st Grade (Above 100000 Reputation Level)jabba_29 User rank is General 11st Grade (Above 100000 Reputation Level)jabba_29 User rank is General 11st Grade (Above 100000 Reputation Level)jabba_29 User rank is General 11st 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 4 Weeks 1 Day 11 h 9 m 14 sec
Reputation Power: 1693
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
Try checking the strpos condition as !== FALSE.

Additionally, does blackberry support that old a version of wap?
I would go for XHTML MP personally.

Of course, if your domain loads index.php by default,
why not do something like
PHP Code:
<?php

if((strpos($usr_agent,"blackberry") !== FALSE){ 
// redirect
// exit();
}
// show default


This would be the wrong way according to dotmobi though.
If it is not a mobile you should redirect, not the other way around.

But anyway, hope that gives you a bit of an idea.
__________________
Cheers,

Jamie

# mdb4u | mobile movie database] | Please help to test and promote
# 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 May 14th, 2007, 12:35 PM
marf marf is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Mar 2003
Posts: 74 marf User rank is Sergeant (500 - 2000 Reputation Level)marf User rank is Sergeant (500 - 2000 Reputation Level)marf User rank is Sergeant (500 - 2000 Reputation Level)marf User rank is Sergeant (500 - 2000 Reputation Level)marf User rank is Sergeant (500 - 2000 Reputation Level) 
Time spent in forums: 4 h 20 m 17 sec
Reputation Power: 12
Quote:
This would be the wrong way according to dotmobi though.
If it is not a mobile you should redirect, not the other way around.

But anyway, hope that gives you a bit of an idea.


So then by default I should have my page go to index.wml?

and if the browser isn't mobile, redirect it to index.php?

Because I have the access to change the default page to index.wml instead of index.php. I'm just wondering how would I write it in the wml page to detect if its mobile or not... same way as I did in the PHP?

Reply With Quote
  #4  
Old May 15th, 2007, 01:47 AM
jabba_29's Avatar
jabba_29 jabba_29 is offline
Back in HEL
Click here for more information.
 
Join Date: Feb 2002
Location: Finland
Posts: 8,910 jabba_29 User rank is General 11st Grade (Above 100000 Reputation Level)jabba_29 User rank is General 11st Grade (Above 100000 Reputation Level)jabba_29 User rank is General 11st Grade (Above 100000 Reputation Level)jabba_29 User rank is General 11st Grade (Above 100000 Reputation Level)jabba_29 User rank is General 11st Grade (Above 100000 Reputation Level)jabba_29 User rank is General 11st Grade (Above 100000 Reputation Level)jabba_29 User rank is General 11st Grade (Above 100000 Reputation Level)jabba_29 User rank is General 11st Grade (Above 100000 Reputation Level)jabba_29 User rank is General 11st Grade (Above 100000 Reputation Level)jabba_29 User rank is General 11st Grade (Above 100000 Reputation Level)jabba_29 User rank is General 11st Grade (Above 100000 Reputation Level)jabba_29 User rank is General 11st Grade (Above 100000 Reputation Level)jabba_29 User rank is General 11st Grade (Above 100000 Reputation Level)jabba_29 User rank is General 11st Grade (Above 100000 Reputation Level)jabba_29 User rank is General 11st Grade (Above 100000 Reputation Level)jabba_29 User rank is General 11st 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 4 Weeks 1 Day 11 h 9 m 14 sec
Reputation Power: 1693
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
Your wml page doesn't need to be .wml. It can still be .php.

wml is just mark up language - it cannot detect what device is browsing the page.

Reply With Quote
  #5  
Old May 15th, 2007, 10:49 AM
marf marf is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Mar 2003
Posts: 74 marf User rank is Sergeant (500 - 2000 Reputation Level)marf User rank is Sergeant (500 - 2000 Reputation Level)marf User rank is Sergeant (500 - 2000 Reputation Level)marf User rank is Sergeant (500 - 2000 Reputation Level)marf User rank is Sergeant (500 - 2000 Reputation Level) 
Time spent in forums: 4 h 20 m 17 sec
Reputation Power: 12
so have my main page index.php,

and within that use WML, and if the device is a Desktop, I forward it to lets say desktop.php, otherwise I stay on index.php where my WML/WAP is?

Reply With Quote
  #6  
Old May 16th, 2007, 01:09 AM
jabba_29's Avatar
jabba_29 jabba_29 is offline
Back in HEL
Click here for more information.
 
Join Date: Feb 2002
Location: Finland
Posts: 8,910 jabba_29 User rank is General 11st Grade (Above 100000 Reputation Level)jabba_29 User rank is General 11st Grade (Above 100000 Reputation Level)jabba_29 User rank is General 11st Grade (Above 100000 Reputation Level)jabba_29 User rank is General 11st Grade (Above 100000 Reputation Level)jabba_29 User rank is General 11st Grade (Above 100000 Reputation Level)jabba_29 User rank is General 11st Grade (Above 100000 Reputation Level)jabba_29 User rank is General 11st Grade (Above 100000 Reputation Level)jabba_29 User rank is General 11st Grade (Above 100000 Reputation Level)jabba_29 User rank is General 11st Grade (Above 100000 Reputation Level)jabba_29 User rank is General 11st Grade (Above 100000 Reputation Level)jabba_29 User rank is General 11st Grade (Above 100000 Reputation Level)jabba_29 User rank is General 11st Grade (Above 100000 Reputation Level)jabba_29 User rank is General 11st Grade (Above 100000 Reputation Level)jabba_29 User rank is General 11st Grade (Above 100000 Reputation Level)jabba_29 User rank is General 11st Grade (Above 100000 Reputation Level)jabba_29 User rank is General 11st 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 4 Weeks 1 Day 11 h 9 m 14 sec
Reputation Power: 1693
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
Yes.

take a look at the dotmobi recommendations for device detection and redirection -
they may help you a bit.

I have written a Drupal module that renders content according to device.
Andymoo has done similar with Wordpress.

Check out the WAP Resources for links..

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - MoreMobile Programming > WAP WML, and PHP


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 6 hosted by Hostway
Stay green...Green IT