Précédent   Forum des professionnels en informatique > PHP > Langage > Débuter
Débuter Forum d'entraide pour débuter en PHP. Avant de poster -> Cours PHP, FAQ PHP, Outils PHP, etc.
Partagez cette discussion sur d'autres réseaux sociaux : Viadeo Twitter Google Facebook Digg Delicious MySpace Yahoo
Réponse Proposer ce sujet en actualité
 
Outils de la discussion
Publicité
'
Vieux 26/07/2011, 18h18   #1
Invité de passage
 
Inscription : février 2007
Messages : 4
Détails du profil
Informations forums :
Inscription : février 2007
Messages : 4
Points : 1
Points : 1
Par défaut Flux RSS pour mon site

Bonjour,

Bonjour,
Voila j'aimerai mettre en place un flux rss sur mon site, mais j'en suis incapable.
Qui pourrait m'aider?
Sur mon site j'ai déjà un post pour les nouveautés. Donc je pense que cela ne devrai pas être mission impossible de créer un flux.
voici le code pour les nouveautés du site :
Code :
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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
<?php 
 
$TITRE .= 'Derniers ajouts'; 
require_once 'haut.php'; if($is_include == true) 
{ 
if(empty($_GET['nbre'])) $page = 0; 
else $page = mysql_real_escape_string($_GET['nbre']); 
 
$count_page = 2100; // 20 pages 
 
$reponse = mysql_query('SELECT L.id,L.id_series,L.episode,L.lien,L.saison,L.langue,L.password,L.uploader,L.date, (SELECT S.principale FROM series S WHERE S.id = L.id_series) AS principale, (SELECT S.titre FROM series S WHERE S.id = L.id_series) AS titre, (SELECT S.apache FROM series S WHERE S.id = L.id_series) AS apache FROM liens_series L ORDER BY L.date DESC, L.id DESC, titre ASC, L.saison ASC, L.episode ASC LIMIT '.$page.',100'); 
echo '<div class="post post-top type-post hentry category-non-classe topPost"> 
<h2 class="topTitle">Derniers ajouts</h2>'; 
 
$arrondi = ceil($count_page / 100)-1; 
$i = 0; 
$abc = null; 
while($i < $arrondi) { $abc .= '<a href="http://'.$_SERVER['HTTP_HOST'].'/derniers-ajouts-'.($i * 100).'.html">'.(((($i * 100) == $page) ? '<span style="color:white;">'.($i+1).'</span>' : ($i+1))).'</a> - '; $i++; } 
$wxyz = 'Page : '.substr($abc,0,-2).'<br/>'; 
echo $wxyz; 
 
$pageb = $page + 100; 
 
$f = null; 
$t = null; 
$princip = array(); 
$ze = null; 
 
echo '<p><b><i>Légende :</i></b> <span style="font-weight:bold;color:green;">récent (- 24h)</span>     <span style="text-decoration:underline;">série populaire</span> </p>'; 
 
while($donnees = mysql_fetch_array($reponse)) 
{ 
if($f != $donnees['id_series']) 
{ 
$ze .= '<br/><div class="arrondi" style="border:1px solid #333333;background:#333333;text-align:center;margin:auto;width:100%;font-family:arial"> 
<h3 style="font-family:Arial;font-size:14px;font-weight:bold;padding:5px;width:100%;margin:0px;"><a href="http://'.$_SERVER['HTTP_HOST'].'/'.EncodeUrl($donnees['apache']).'/" target="_blank">'.$donnees['titre'].'</a></h3></div>'; 
$f = $donnees['id_series']; 
} 
 
$langue = strtolower($donnees['langue']); 
if($donnees['langue'] == 'VF') $donnees['langue'] = 'http://'.$_SERVER['HTTP_HOST'].'/images/fr.gif" title="VF" style="vertical-align:bottom;text-align:left;padding-left:10px;padding-right:10px;'; 
elseif($donnees['langue'] == 'VF/VOSTFR') $donnees['langue'] = 'http://'.$_SERVER['HTTP_HOST'].'/images/vfvo.gif" title="VF/VOSTFR" style="vertical-align:bottom;text-align:left;padding-left:10px;padding-right:10px;'; 
elseif($donnees['langue'] == 'VOSTFR') $donnees['langue'] = 'http://'.$_SERVER['HTTP_HOST'].'/images/vost.gif" title="VOSTFR" style="vertical-align:bottom;text-align:left;padding-left:10px;'; 
elseif($donnees['langue'] == 'VO') $donnees['langue'] = 'http://'.$_SERVER['HTTP_HOST'].'/images/en.gif" title="VO" style="vertical-align:bottom;text-align:left;padding-left:10px;padding-right:10px;'; 
 
$ze .= '<table style="width:100%;margin:auto;text-align:left;" style=""><tr class="gris"> 
<td width="300" style="vertical-align:middle;text-align:left;"> 
 
<img src="'.$donnees['langue'].'" align="absmiddle" />  
<a href="http://'.$_SERVER['HTTP_HOST'].'/'.EncodeUrl($donnees['apache']).'/#s'.$donnees['saison'].'-'.$langue.'" class="info" style="'.(($donnees['principale'] == 'oui') ? 'text-decoration:underline;' : '').(((time() - 86400) < $donnees['date']) ? 'font-weight:bold;color:green;' : '').'"> 
Saison '.$donnees['saison'].' - Episode '.$donnees['episode']; 
$ze .= '<span style="font-weight:normal;">par <i>'.$donnees['uploader'].'</i></span>'; 
if(!empty($_SESSION['pseudo'])) $ze .= '</a>   <a href="'.$donnees['lien'].'"><i>'.$donnees['lien'].'</i></a>'; 
else $ze .= '</a>   <a href="http://'.$_SERVER['HTTP_HOST'].'/link.php?id='.$donnees['id'].'"><i>http://'.$_SERVER['HTTP_HOST'].'/link.php?id='.$donnees['id'].'</i></a>'; 
if(!empty($donnees['password'])) $ze .= '<span style="color:red;padding-left:10px;"><b>Infos : </b> '.substr($donnees['password'],0,15).((strlen($donnees['password']) > 15) ? ' [...]' : '').'</span>'; 
$ze .= '</td></tr></table>'; 
} 
mysql_free_result($reponse); 
echo $ze.'<br/><br/>'.$wxyz; 
echo '<div class="cleared"></div></div></div>'; 
require_once 'menu.php'; 
} 
 
?>
J'ai trouvé ceci : http://www.sebsauvage.net/comprendre/rss/creer.html mais comme je le dis plus haut, je suis incapable de mettre ce flux en place
Qui peux m'aider???
1000 merci d'avance
stero11 est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 26/07/2011, 18h43   #2
Invité de passage
 
Inscription : février 2007
Messages : 4
Détails du profil
Informations forums :
Inscription : février 2007
Messages : 4
Points : 1
Points : 1
J'ai aussi trouvé ceci : http://scripts.toocharger.com/fiches...x-rss/4057.htm
stero11 est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 30/07/2011, 12h52   #3
Membre du Club
 
Inscription : novembre 2005
Messages : 103
Détails du profil
Informations forums :
Inscription : novembre 2005
Messages : 103
Points : 44
Points : 44
Envoyer un message via MSN à Legenyes
hello,

voici peut etre deux fonctions qui te seront utiles::
Code :
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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
function init_news_rss(&$xml_file)
	{
        $root = $xml_file->createElement("rss"); // création de l'élément
        $root->setAttribute("version", "2.0"); // on lui ajoute un attribut
        $root = $xml_file->appendChild($root); // on l'insère dans le nœud parent (ici root qui est "rss")
 
        $channel = $xml_file->createElement("channel");
        $channel = $root->appendChild($channel);
 
        $desc = $xml_file->createElement("description");
        $desc = $channel->appendChild($desc);
        $text_desc = $xml_file->createTextNode("Tout ce qu'il faut pour bien démarrer. Un package complet pour débuter une nouvelle entreprise"); // on insère du texte entre les balises <description></description>
        $text_desc = $desc->appendChild($text_desc);
 
        $link = $xml_file->createElement("link");
        $link = $channel->appendChild($link);
        $text_link = $xml_file->createTextNode("http://www.startbox.be");
        $text_link = $link->appendChild($text_link);
 
        $title = $xml_file->createElement("title");
        $title = $channel->appendChild($title);
        $text_title = $xml_file->createTextNode("Startbox");
        $text_title = $title->appendChild($text_title);
 
        return $channel;
	}
 
 
	function add_news_node(&$parent, $root, $id, $pseudo, $titre, $contenu, $date)
	{
        $item = $parent->createElement("item");
        $item = $root->appendChild($item);
 
        $title = $parent->createElement("title");
        $title = $item->appendChild($title);
        $text_title = $parent->createTextNode($titre);
        $text_title = $title->appendChild($text_title);
 
        $link = $parent->createElement("link");
        $link = $item->appendChild($link);
        $text_link = $parent->createTextNode("http://www.startbox.be/offres-". $id .".html");
        $text_link = $link->appendChild($text_link);
 
        $desc = $parent->createElement("description");
        $desc = $item->appendChild($desc);
        $text_desc = $parent->createTextNode($contenu);
        $text_desc = $desc->appendChild($text_desc);
 
        $com = $parent->createElement("comments");
        $com = $item->appendChild($com);
        $text_com = $parent->createTextNode("http://www.startbox.be/offres-". $id .".html");
        $text_com = $com->appendChild($text_com);
 
        $author = $parent->createElement("author");
        $author = $item->appendChild($author);
        $text_author = $parent->createTextNode($pseudo);
        $text_author = $author->appendChild($text_author);
 
        $pubdate = $parent->createElement("pubDate");
        $pubdate = $item->appendChild($pubdate);
        $text_date = $parent->createTextNode($date);
        $text_date = $pubdate->appendChild($text_date);
 
        $guid = $parent->createElement("guid");
        $guid = $item->appendChild($guid);
        $text_guid = $parent->createTextNode("http://www.startbox.be/offres-". $id .".html");
        $text_guid = $guid->appendChild($text_guid);
 
        $src = $parent->createElement("source");
        $src = $item->appendChild($src);
        $text_src = $parent->createTextNode("http://www.startbox.be/");
        $text_src = $src->appendChild($text_src);
	}
bonne chance
Legenyes est déconnecté   Envoyer un message privé Réponse avec citation 00
Réponse Proposer ce sujet en actualité
Outils de la discussion



Fuseau horaire GMT +2. Il est actuellement 07h49.


 
 
 
 
Partenaires

Hébergement Web