Helpful Information
 
 
Category: Mobile Programming
Web Clipping..?

I am looking for some docs or information on setting up the site to detect wireless devices. I have done some research on web clipping but have not found many good sources of information. I know how I could do something close with PHP but then you have to know to search for every wireless browser or OS. That seems like a real pain. Any help would be great.

Heyup !

This is no fun really.. I know you said you didn't want to use PHP but some useful info can be gleaned from PHPbuilder (http://www.phpbuilder.com/mail/php-windows/2002012/0045.php).

It would have been nice if the WAP "standards" body had decided that all WAP browsers would have the word "WAP" in the identification string, but that would have been too easy :p

Anyway, another method can be found at the Wireless Developer Network (http://www.wirelessdevnet.com/channels/wap/expert/) under How do you create a single index file that generates both WML and HTML?

Hope this helps !

peterg22 thanks for the post. I like your sarcasm about WAP and the standards. That was actually very useful. I am more then happy to use PHP but I thought there was a specific way to do mobile site programming like a program that would create wml or a ref that would tell you how you would go about doing it. Here are some books I will have to take a look at.

wml books (http://www.amazon.com/exec/obidos/external-search/102-2263944-8101728?PHPSESSID=2ce0e5062dc19d80adb66330bd5e7a48&mode=books&keyword=wml&tag=ipdg3-20&Go.x=10&Go.y=13)

Well, I have to admit that I have only invested time (a lot) and (very little) money in my WAP development. The main problem as far as I have been concerned is that to take full advantage of all the available WAP features and produce optimised code I think there is quite an investment in software.

So, I initially used my own copies of Apache, MySQL and PHP, and this has worked very well. Most of my stuff is concerned with database enquiry and retrieval. I use the Deckit emulator from pyweb.com (http://www.pyweb.com) and as this is very lightweight it is very fast, but it does the job. All the WAP pages are created with the vi editor. The main point here is that you don't need loads of (expensive) stuff to get started - if you are already writing HTML you shouldn't have too many problems.. I found that the page size returned to the mobile phone was difficult to control initially, and this is where you will find that an emulator will usually display a page whereas a "real" mobile phone will just give you an error.

If you want some examples of the pages I have done please let me know and I can send you some.

I would not mind seeing some. Basically what I did is this I made all my pages <table width='150'> then it is not to big or to small. fits in a pda pretty good and a phone not so bad. The wireless site I created came out pretty good I think. I took out all the non mobile type stuff like images, uploads, download, etc. I realize on some devices you can do this but on the majority you can not.

Hmmm .. never really tried tables much, but that could be interesting on PDAs: i'll give that a try.. I haven't really done much with PDAs up until now as I have simply used your trick of specifying a table width and using standard HTML. However, the thought of being able to use common code for mobile and PDA appeals to me a lot. I am thinking of taking the easy way out and just using a PDA browser that supports WML :)

As regards some sample code:

This one is a simple pick list that just demonstrates how you can generate a list of items and eventually pass the selected values to another page. I use php for the WAP header, although this could be hard coded in "WML". It also demonstrates how to pass a variable using postfield.


<?php
header("Content-type: text/vnd.wap.wml");
echo "<?xml version=\"1.0\"?>";
echo "<!DOCTYPE wml PUBLIC \"-//WAPFORUM//DTD WML 1.1//EN\""
. " \"http://www.wapforum.org/DTD/wml_1.1.xml\">";
?>
<wml>
<card id="card1" title="Shopping">
<p>
<do type="accept">
<go href="wap.php" method="post">
<postfield name="items" value="$Items"/>
</go>
</do>
Shoppinglist:<br/>
<select name="Items" multiple="true">
<option value="1">Beer</option>
<option value="2">Curry</option>
<option value="3">Veg</option>
<option value="4">Milk</option>
<option value="5">Tuna fish</option>
<option value="6">Salad</option>
<option value="7">Meat</option>
<option value="8">Cat Food</option>
</select>
</p>
</card>
</wml>

This is a handy one if you want to let people call your mobile from a WAP page ;) It also incorporates a bitmap graphic. You'll see quite a few headers at the top (courtesy of PHP) - this is a desperate attempt to stop the phone browser using it's cache. I found this was a big problem especially with database work..


<?php
header("Content-type: text/vnd.wap.wml");
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
header("Cache-Control: no-cache, must-revalidate");
header("Pragma: no-cache");
echo "<?xml version=\"1.0\"?>";
echo "<!DOCTYPE wml PUBLIC \"-//WAPFORUM//DTD WML 1.1//EN\""
. " \"http://www.wapforum.org/DTD/wml_1.1.xml\">";
echo "\n\n";
?>
<wml>
<head>
<meta http-equiv="Cache-Control" content="must-revalidate" forua="true"/>
<meta http-equiv="Cache-Control" content="max-age=0" forua="true"/>
</head>

<template>
<do type="prev" label="Previous">
<prev/>
</do>
</template>


<card id="card1" title="Call me">
<p>
<img src="dearfriend.wbmp" alt="[Our Logo]"/>
<br/>
<anchor>Call Me
<go href="wtai://wp/mc;insert-your-mobile-number-here"/>
</anchor>
<br/>
</p>
</card>
</wml>

And this one is a bit longer, but it shows database connection (uses MySQL), creating an SQL query and displaying the result. I chopped the title down to 20 characters and uses PHP's htmlentities feature to stop the phone barfing on any "reserved" characters in the review string that it retrieves.


<?php
header("Content-type: text/vnd.wap.wml");
echo "<?xml version=\"1.0\"?>";
echo "<!DOCTYPE wml PUBLIC \"-//WAPFORUM//DTD WML 1.1//EN\""
. " \"http://www.wapforum.org/DTD/wml_1.1.xml\">";
?>
<wml>
<head><meta http-equiv="Cache-Control" content="max-age=1"/></head>
<template>
<do type="prev" label="Previous">
<prev/>
</do>
</template>
<card id="card0" title="My DB Lookup">
<p>
<?php
if ( $DBcon = mysql_connect("localhost", "username","password") )
{
mysql_select_db("products");
$query = "select Title, Review from Reviews where Pno = '123456'";
$result = mysql_query($query);
if ( mysql_num_rows($result) )
{
$row = mysql_fetch_array($result);
$RV = $row[Review];
$TI = $row[Title];
echo "<small>";
echo substr($TI, 0, 20) . "...";
echo "</small>";
echo "<br/>";
echo htmlentities($RV);
echo "<br/>";
echo "<anchor>Main";
echo "<go href=\"index.wml\"/>";
echo "</anchor>";
}
else
{
echo "Sorry - we are unable to find the review for this product.";
}
mysql_close($DBcon);
}
else
{
echo "Sorry - we have a database problem right now";
}
?>
</p>
</card>
</wml>


Have fun, and keep in touch !










privacy (GDPR)