Aller au contenu

WML + PHP = erreur ?


lich

Sujets conseillés

Bonjour.

Je suis un debutant en WML et c'est surement pour ca que je ne comprend pas ou est mon erreur.

J'essaye d'acceder a mon site wap, via mon portable, mais il me dit que c'est impossible :(

Est-ce que quelqu'un peut m'aider?

Merci d'avence.

A+

Voici mon script:

<? 
header("Content-Type: text/vnd.wap.wml");
echo '<'.'?xml version="1.0" encoding="iso-8859-1"?'.'>';
?>
<!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML
1.1//EN" "http://www.wapforum.org/DTD/wml_1.1.xml">
<wml>

<card id="index" title="lalala">
<p align="center">
<img src="http://www.site.com/wap/wap.wbmp"/>
</p>
<p>- <a href="#tchat">Le tchat du forum</a></p>
</card>

<card id="tchat" title="tchat">
<p align="center"><img src="http://www.site.com/wap/wap.wbmp"/></p>
<p align="center"><strong>Le TCHAT</strong></p><br/>
<?
$liendb = mysql_connect("localhost", "login", "passe");
mysql_select_db ("table");

$req_titre2 = mysql_query("SELECT * FROM phpbb_shout
ORDER BY shout_id DESC LIMIT 5", $liendb);
while ($message_titre2 = mysql_fetch_array ($req_titre2))
{
$shout_user_id = $message_titre2['shout_user_id'];
$shout_text = $message_titre2['shout_text'];

$sql223 = "SELECT username FROM phpbb_users where user_id = '$shout_user_id'";
$resultat223 = mysql_query ($sql223) or die(mysql_error());
$message = mysql_fetch_array ($resultat223);
$username = $message['username'];

echo '<p><b><u>'. $username .'</u> :</b></p>';
echo '<p><i>'. $shout_text .'</i></p>';
}

echo '<br/>
<p align="left"><a href="#index">RETOUR</a></p>
</card>
</wml>';

?>

Pourtant, avec mon WinWap ( = browser pour voir les pages wap ), ca marche mais pas sur mon portable.

Voici la source que winwap me donne lorsqu'il voit la page:

(ou est l'erreur?)

HTTP/1.1 200 OK

Date: Mon, 22 Nov 2004 15:46:42 GMT

Server: Apache/1.3.31 (Unix) PHP/4.3.9 SecurityModule/2.0

X-Powered-By: PHP/4.3.9

Connection: close

Content-Type: text/vnd.wap.wml

<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML
1.1//EN" "http://www.wapforum.org/DTD/wml_1.1.xml">
<wml>

<card id="index" title="lalala">
<p align="center"><img src="http://www.site.com/wap/wap.wbmp"/></p>
<p>- <a href="#tchat">Le tchat du forum</a></p>
</card>

<card id="tchat" title="tchat">
<p align="center"><img src="http://www.site.com/wap/wap.wbmp"/></p>
<p align="center"><strong>Le TCHAT</strong></p><br/>
<p><b><u>login</u> :</b></p><p><i>texte</i></p>
<p><b><u>login2</u> :</b></p><p><i>texte2</i></p>
<p><b><u>login3</u> :</b></p><p><i>texte3</i></p>
<p><b><u>login4</u> :</b></p><p><i>texte4</i></p>
<p><b><u>login5</u> :</b></p><p><i>texte5</i></p>
<br/>
<p align="left"><a href="#index">RETOUR</a></p>
</card>
</wml>

Lien vers le commentaire
Partager sur d’autres sites

Salut,

Sache qu'il n'y a en principe aucun problème à faire du php pour une page WAP. Ca DOIT marcher.

Par contre, ton code doit être impeccable. A la moindre erreur, tu peux faire tes bagages ;)

Il est aussi tout à fait normal qu'un "visionneur" te l'affiche sans problème : ceux-ci sont plus tolérants que les vrais portables.

Ces quelques précisions étant faites, je vais tester ton code, et si je trouve la faille je reposte ici (ça fait au moins un an que j'ai pas fait une page wap :!: )

Au plaisir,

Ernestine

Modifié par Ernestine
Lien vers le commentaire
Partager sur d’autres sites

Re,

Tout d'abord, je vais te conseiller deux choses :

1/ Lire ces deux articles du Hub ( celui-ci et celui-là ) qui présentent les bases du WML.

2/ Utiliser un validateur !! C'est la meilleure méthode pour réussir une page wap. Prends le validateur du W3C : http://validator.w3.org/

Et y testant ta page, on reçoit toute une flopée d'erreurs, notamment :

_ balises ALT non renseignées

_ tu as placé des balises BR/ en dehors de paragraphes (eh oui c'est interdit)

C'est bien plus qu'il n'en faut pour empêcher l'affichage sur ton téléphone... :(

Quant aux autres erreurs, je ne peux pas t'en parler puisque je ne peux pas tester les requêtes mysql. Mais si je supprime ces requêtes et que je corrige les erreus ci-dessus, ça marche nickel.

Pour ton info voici le résultat du test (qui bien sûr ne vaut rien tant que la page n'est pas sur ton serveur (à cause des requêtes sql)) :

   1.

     Line 7, column 44: required attribute "alt" not specified

     <img src="http://www.site.com/wap/wap.wbmp"/>

     The attribute given above is required for an element that you've used, but you have omitted it. For instance, in most HTML and XHTML document types the "type" attribute is required on the "script" element and the "alt" attribute is required for the "img" element.

     Typical values for type are type="text/css" for <style> and type="text/javascript" for <script>.

     ✉
  2.

     Line 13, column 62: required attribute "alt" not specified

     ...n="center"><img src="http://www.site.com/wap/wap.wbmp"/></p>

     ✉
  3.

     Line 14, column 51: document type does not allow element "br" here; assuming missing "p" start-tag

     <p align="center"><strong>Le TCHAT</strong></p><br/>

     ✉
  4.

     Line 26, column 15: document type does not allow element "p" here

     <p align="left"><a href="#index">RETOUR</a></p>

     The element named above was found in a context where it is not allowed. This could mean that you have incorrectly nested elements -- such as a "style" element in the "body" section instead of inside "head" -- or two elements that overlap (which is not allowed).

     One common cause for this error is the use of XHTML syntax in HTML documents. Due to HTML's rules of implicitly closed elements, this error can create cascading effects. For instance, using XHTML's "self-closing" tags for "meta" and "link" in the "head" section of a HTML document may cause the parser to infer the end of the "head" section and the beginning of the "body" section (where "link" and "meta" are not allowed; hence the reported error).

     ✉
  5.

     Line 27, column 6: end tag for "p" omitted, but OMITTAG NO was specified

     </card>

     You may have neglected to close a tag, or perhaps you meant to "self-close" a tag; that is, ending it with "/>" instead of ">".

     ✉
  6.

     Line 14, column 47: start tag was here

     <p align="center"><strong>Le TCHAT</strong></p><br/>

Au plaisir,

Ernestine

Lien vers le commentaire
Partager sur d’autres sites

Veuillez vous connecter pour commenter

Vous pourrez laisser un commentaire après vous êtes connecté.



Connectez-vous maintenant
×
×
  • Créer...