Jūs esateŽurnalai / Ernestas Kardzys's blog / PHP & WML. How to create a web page for the mobile phone

PHP & WML. How to create a web page for the mobile phone


ParašėErnestas Kardzys - 2009 Liepos 30

I have Sony Ericsson K550i mobile phone. And I decided to create a small web page. I know PHP a little, so I was creating the web page on PHP. The main point is to add a WML header for the web page. Code is as fallows:
header("Content-type: text/vnd.wap.wml"); echo "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"; echo "<!DOCTYPE wml PUBLIC \"-//WAPFORUM//DTD WML 1.1//EN\"" . " \"http://www.wapforum.org/DTD/wml_1.1.xml\">\n";
So, we have this. Then we need other parts:
echo '<wml><card id="cool_page" title="The Title Of My Awesome Page">';
<wml> is something like <html> in HTML. Then lets create a web page:
echo '<table border="1"> <tr><td><b>Name</b></td><td><b>Price</b></td></tr> <tr><td>Candy</td><td>15.3</td></tr> <tr><td>Chocolate</td><td>6.6</td></tr> <tr><td>Sugar</td><td>0.23</td></tr> </table>';
And at the end we finish the document:
echo '</card></wml>';
As a result, our web page looks like that:
<?php header("Content-type: text/vnd.wap.wml"); echo "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"; echo "<!DOCTYPE wml PUBLIC \"-//WAPFORUM//DTD WML 1.1//EN\"" . " \"http://www.wapforum.org/DTD/wml_1.1.xml\">\n"; echo '<wml><card id="cool_page" title="The Title Of My Awesome Page">'; echo '<table border="1"> <tr><td><b>Name</b></td><td><b>Price</b></td></tr> <tr><td>Candy</td><td>15.3</td></tr> <tr><td>Chocolate</td><td>6.6</td></tr> <tr><td>Sugar</td><td>0.23</td></tr> </table> </card> </wml>' ?>
There is one very cool plugin for Mozilla Firefox, if you want to test it. It's called: wmlbrowser. Just point to Tools->Add-ons. Or you can test it in your mobile phone, if it supports WAP :) Good luck ;)

Teisybė ;)
Tačiau čia tik pavyzdys. Aš tau permesiu kitą, mano pagamintą produktą :)

Šiaip tokiam puslapiui sukurti php nereikalingas, nes nieko iš duomenų bazės negeneruoji :)

thanks ;-)

Skelbti naują komentarą

Šio laukelio turinys bus laikomas privatus ir nerodomas viešai.
  • Web puslapiu adresai ir el. pašto adresai automatiškai tampa nuorodomis.
  • Leidžiamos HTML žymės: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd>
  • Linijos ir paragrafai atskiriami automatiškai
  • You can enable syntax highlighting of source code with the following tags: <code>, <blockcode>, <c>, <cpp>, <drupal5>, <drupal6>, <java>, <javascript>, <php>, <python>, <ruby>. The supported tag styles are: <foo>, [foo].

Daugiau informacijos apie teksto formatavimą

CAPTCHA
Šis klausimas yra skirtas įsitikinti, jog jūs esate žmogus, ir sustabdyti automatinį šlamšto siuntimą.
12 + 2 =
Išspręskite šią paprastą matematinę užduotį ir įveskite atsakymą. Pvz., jei užduotis yra 1+3, įveskite 4.