|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
||||
|
||||
|
Creating WAP pages with PHP
I am busy developing a site that will need to be accessed by both WAP and normal browsers. The normal browser access is OK and the site is finished for that - now comes to big problem:
I need to create content based on a MySQL database for use on WAP, my only means of accessing the MySQL db is using PHP from a Linux server. I've tried a test that is supposed to display Hi on the WAP browser. This does not work it gives me the following error: Unsupported content type: text/html The code below is the original code I tried. After that I included Header("Content-type: text/wml"); with Content-type changing from text/wml to text/xml to xml to wml to xml/wml to no avail. <? print "<?xml version=\"1.0\" encoding=\"UTF-8\"?> <!DOCTYPE wml PUBLIC \"-//WAPFORUM//DTD WML 1.1//EN\" \"http://www.wapforum.org/DTD/wml_1.1.xml\"> <wml> <template> <do type=\"options\" name=\"prev\" label=\"Back\"> <prev/> </do> </template> <card title=\"Page Title\" id=\"first\"> <p align=\"center\">Hi</p> </card> </wml> "; ?> Your help would be greatly appreciated |
|
#2
|
|||
|
|||
|
you want something more like this....
<? header("Content-type: text/vnd.wap.wml"); echo("<?xml version=\"1.0\"?>\n"); echo("<!DOCTYPE wml PUBLIC \"-//WAPFORUM//DTD WML 1.1//EN\"" ." \"http://www.wapforum.org/DTD/wml_1.1.xml\">\n"); ?> <wml> <template> <do type="options" name="prev" label="Back"> <prev/> </do> </template> <card title="Page Title" id="first"> <p align="center">Hi</p> </card> </wml> The stuff inbetween the <? ?> is php, outside is WML. Not the line that reads header("Content-type: text/vnd.wap.wml"); This tells the client browser that WML follows. Note - you'll need a wml browser to view your pages. |
|
#3
|
||||
|
||||
|
Thanks topls64 - now I can finish (at last)
|
|
#4
|
|||
|
|||
|
Just note the bottom have of the example I gave was in wml. You can, however, output the wml via php, like this....
PHP Code:
This allows you to add variables, etc.... |
|
#5
|
||||
|
||||
|
Figured that.
Thanks anyway |
|
#6
|
|||
|
|||
|
Hi,
How do i view the pages ? Also do i name the pages as mypage.wml or mypage.php ? I am on CPanel based server and I have same issues. I have now created a sample page using the code provided above but i don't know what extension to give it ? Please help. Thanks. |
|
#7
|
||||
|
||||
|
Hi kikloo, welcome to Devshed!
In future please do not dig up posts that are this old - please use a bit of common sense. Your questions aren't even relevant to the original post.. Anyway, to answer your questions: 1: How do i view the pages ? FAQ #5 2: Also do i name the pages as mypage.wml or mypage.php -up to you, provided that you can get your server to parse .wml as php it doesn't matter 3: I am on CPanel based server and I have same issues. Probably your php isn't working if you are using short_tags (<?) - see recent threads in the PHP forum about this: one to get you started WAP is not that useful these days anyway, you may want to investigate XHTML MP, see WAP Resources for more info. HTH and good luck.
__________________
Cheers, Jamie # mdb4u | The 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. ![]() __________________ |
![]() |
| Viewing: Dev Shed Forums > Programming Languages - More > Mobile Programming > Creating WAP pages with PHP |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|