Communauté Informatique NDFR.net

Communauté Informatique NDFR.net (http://www.ndfr.net/forums/index.php)
-   Programmation Web (HTML, PHP, ASP, Java, XML, etc.) (http://www.ndfr.net/forums/forumdisplay.php?f=65)
-   -   comment créer un site comme ND (http://www.ndfr.net/forums/showthread.php?t=2388)

Samva 09-07-2003 23:29

Je m'excuse mais j'ai rien moi quand je clique sur le liens...

Benjy 09-07-2003 23:33

Il manque quelque chose en tout début du code PHP les petits amis :
Code:

header("Content-type: text/xml");
:cool:

Samva 09-07-2003 23:34

Bon en fait, la page (ouverte avec moz) donne ca..

Code:

<?xml version="1.0"?>
<rss version="0.92"> 
<channel>
<title>CDivxstater</title>
<description>
création d'un cd outils pour réparer son PC
</description>
<link>http://cdivxstarter.free.fr</link>
<language>fr-fr</language>
<copyright>© moi 2003</copyright>
<managingEditor>kenshin51@voila.fr</managingEditor>
<webMaster>kenshin51@voila.fr</webMaster>

<item>
<title>test</title>
<link>http://cdivxstarter.free.fr/freenews....php?id_news=2</link>
<comments>
http://cdivxstarter.free.fr/comment.php?id=
</comments>
<pubDate>06/07/2003</pubDate>
</item><item>
<title>Bonjour cdivxstater</title>
<link>http://cdivxstarter.free.fr/freenews....php?id_news=1</link>
<comments>
http://cdivxstarter.free.fr/comment.php?id=

</comments>
<pubDate>06/07/2003</pubDate>
</item>
</channel>
</rss>

On voit bien qu'il y a des problème avec tes balises item qui ne sont pas a la ligne... mais c'est tout.

Samva 09-07-2003 23:36

Grillaid, marfi Benjy

kenshin 10-07-2003 12:18

j'ai ajouté cette ligne : header("Content-type: text/xml");

en dessous de <?php

est ce bon ?

voila ce qu'il me dit quand j'essaie d'afficher la page http://cdivxstarter.free.fr/freenews/menu4.php
Code:

  création d'un cd outils pour réparer son PC  http://cdivxstarter.free.fr fr-fr © moi 2003 kenshin51@voila.fr kenshin51@voila.fr
Warning: Cannot add header information - headers already sent by (output started at /var/www/free.fr/13/c/d/i/v/cdivxstarter/freenews/menu4.php:2) in menu4.php on line 16
http://cdivxstarter.free.fr/freenews....php?id_news=2 http://cdivxstarter.free.fr/comment.php?id= 06/07/2003 http://cdivxstarter.free.fr/freenews....php?id_news=1 http://cdivxstarter.free.fr/comment.php?id= 06/07/2003


Matt 10-07-2003 16:10

c'est parce que le header doit être envoyé avant l'envoi de code HTML.
Met ça tout au début du fichier :
PHP Code:

<?php header("Content-type: text/xml"); ?>


kenshin 10-07-2003 17:08

ok Matt c'est ajouté.
il y a du mieux :

j'ai ceci maintenant
Code:

The XML page cannot be displayed
Cannot view XML input using style sheet. Please correct the error and then click the Refresh button, or try again later.


--------------------------------------------------------------------------------

Erreur non reconnue

voici le code de la page :
Quote:

<?php header("Content-type: text/xml"); ?>
<?
echo '<?xml version="1.0"?'.'>';
?>
<rss version="0.92">
<channel>
<title>CDivxstarter</title>
<description>
création d'un cd outils pour réparer son PC
</description>
<link>
http://cdivxstarter.free.fr</link>
<language>fr-fr</language>
<copyright>© moi 2003</copyright>
<managingEditor>kenshin51@voila.fr</managingEditor>
<webMaster>kenshin51@voila.fr</webMaster>

<?php
$chemin = "./";//->chemin par rapport à la racine du script freenews
$nbnews = 5; //->nombre de news à afficher

include ($chemin . "config.php");
include ($chemin . "options.inc.php");
include ($chemin . "freenews_functions.inc.php");

//->Connection MySQL
connexion();

$sql = "SELECT id_news, titre, auteur, date_ajout FROM news WHERE validation='1' ORDER BY id_news DESC LIMIT 0, " . $nbnews;
$res = mysql_query($sql);
$nbn = mysql_num_rows($res);
while($aff = mysql_fetch_array($res)) {
if(strlen($aff['titre'] >= 30))
$aff['titre'] = substr($aff['titre'], 0, 25) . "...";

echo "<item>\n<title>" . $aff['titre'] . "</title>\n<link>" . $url_suite . "?id_news=" . $aff['id_news'] .
"</link>\n<comments>\nhttp://cdivxstarter.free.fr/comment.php?id=\n</comments>\n<pubDate>" .
$aff['date_ajout'] . "</pubDate>\n</item>";

}
mysql_close();//->je suis méticuleux, je ferme la connection
?></channel>
</rss>
où est l'erreur :( :( :( ?

Samva 10-07-2003 19:59

Euh, ta version actuelle de menu4.php rulaize...
J'ai ca...
Code:

  <?xml version="1.0" encoding="ISO-8859-1" ?>
- <rss version="0.92">
- <channel>
  <title>CDivxstarter</title>
  <description>création d'un cd outils pour réparer son PC</description>
  <link>http://cdivxstarter.free.fr</link>
  <language>fr-fr</language>
  <copyright>© moi 2003</copyright>
  <managingEditor>kenshin51@voila.fr</managingEditor>
  <webMaster>kenshin51@voila.fr</webMaster>
- <item>
  <title>test</title>
  <link>http://cdivxstarter.free.fr/freenews....php?id_news=2</link>
  <comments>http://cdivxstarter.free.fr/comment.php?id=</comments>
  <pubDate>06/07/2003</pubDate>
  </item>
- <item>
  <title>Bonjour cdivxstater</title>
  <link>http://cdivxstarter.free.fr/freenews....php?id_news=1</link>
  <comments>http://cdivxstarter.free.fr/comment.php?id=</comments>
  <pubDate>06/07/2003</pubDate>
  </item>
  </channel>
  </rss>


kenshin 10-07-2003 20:55

ben ça alors tout à l'heure cela ne fonctionnait pas. :eek: :eek:

Par contre l'appelet javascript ne fonctionne toujours pas.


<script language="JavaScript" src="http://cdivxstarter.free.fr/freenews/menu4.php" type="text/javascript"></script>

Matt 10-07-2003 22:03

Ben ... Quand je regarde la page qui est censé contenir ton javascript, je me retrouve avec une page XML, donc c'est un peu logique que ça marche pas ...

kenshin 10-07-2003 22:22

ben oui c'est bien ce que je comprenais pas donc

à quoi sert le format xml et comment l'utiliser ?

Samva 10-07-2003 23:00

Apres il faut un parser... pour le parcourir et récupérer rapidement les infos...

globalement le XML c'est un format universel et extensible de données... n'importe quel soft avec le bon schéma est capable de comprendre/interpréter les contenu...

kenshin 11-07-2003 09:38

Quote:

Provient du message de Samva
Apres il faut un parser... pour le parcourir et récupérer rapidement les infos...

globalement le XML c'est un format universel et extensible de données... n'importe quel soft avec le bon schéma est capable de comprendre/interpréter les contenu...

ok merci
comment rendre utilisable le script alors .

Samva 11-07-2003 21:26

Ben tu fais un fichier RSS la... donc n'importe quel soft qui sait récupérer les info par RSS est capable d'exploiter le script... (enfn me semble, faudrai que je révise mes classiques RSS...)

kenshin 11-07-2003 21:58

ok merci samva


All times are GMT +2. The time now is 18:28.

Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.