bonjour,
j'ai un fichier maj-rss.php qui me génére un fichier fluxrss.xml devant affichier les 10 derniers articles de la base.
Probléme, il me génére bien le départ avec les infos, mais ne m'insére pas les dix derniers articles !
Voici le code:
Alors là, je patauge !
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45 <?php $xml = '<?xml version="1.0" encoding="iso-8859-1"?><rss version="2.0">'; $xml .= '<channel>'; $xml .= '<title>Militaria.fr</title>'; $xml .= '<link>http://www.militaria.fr</link>'; $xml .= '<description>Achat et vente de militaria de collection </description>'; $xml .= '<copyright>© Militaria.fr</copyright>'; $xml .= '<language>fr</language>'; $xml .= '<image>'; $xml .= ' <title>Militaria.fr</title>'; $xml .= ' <url>http://www.militaria.fr/rss/rss.gif</url>'; $xml .= ' <link>http://www.Militaria.fr</link>'; $xml .= '</image>'; $jourdui= date("D, d M Y H:i:s +0100"); $xml .= '<pubdate>'.$jourdui.'</pubdate>'; require ('connect.php'); $res=mysql_query("select * from kpro_shop_articles order by date desc limit 0, 10"); // extraction des 10 dernièrs articles while($lig=mysql_fetch_array($res)){ $title=$lig[tag]; $adresse=$lig[adresse]; $descr=$lig[descr]; $madate=$lig[jourdui]; $datephp=date("D, d M Y H:i:s +0100", strtotime($madate)); $xml .= '<item>'; $xml .= '<title>'.$title.'</title>'; $xml .= '<link>'.$adresse.'</link>'; $xml .= '<pubDate>'.$datephp.'</pubDate>'; $xml .= '<description>'.$descr.'</description>'; $xml .= '</item>'; } $xml .= '</channel>'; $xml .= '</rss>'; $fp = fopen("fluxrss.xml", 'w+'); fputs($fp, $xml); fclose($fp); echo 'Export XML effectue !<br><a href="fluxrss.xml">Voir le fichier</a>'; ?>
En live, cela donne :http://www.militaria.fr/rss/maj-rss.php
merci de votre aide![]()
Partager