I’ve written the follow php code in a rss.php file.
It works fine, but when I put it on a tool bar, I don’t see the links.
IF I click on the open RSS , all is perfect.
I think it is because I used a php file instead of XML file.
BUT if I put a XML extension then the php doesn’t work.
How do I get around this ?
TIA
Pat
<?php
echo "<?xml version=\\"1.0\\" encoding=\\"iso-8859-1\\"?>";
echo "<rss version=\\"2.0\\">";
echo "<channel>";
//<!-- title here give the proposed bookmark name -->
echo "<title>zzz RSS</title>";
echo " <link>http://www.zzz.info/rss.php</link>";
echo " <description>zzz</description>";
echo " <pubDate> aug, 19 2010 00:12:30 EST </pubDate>";
echo " <lastBuildDate> aug, 19 2010 00:12:30 EST </lastBuildDate>";
echo " <ttl> 120 </ttl>";
echo " <category> newspapers </category>";
echo " <copyright> Copyright 2004, NotePage, Inc.</copyright>";
echo " <webMaster> webmaster@notepage.net </webMaster>";
echo "<managingEditor> webmaster@notepage.net </managingEditor>";
echo "before image";
echo "<language>fr</language>";
echo "<image>";
echo " <title>www.zzz.info</title>";
echo " <description>Mon Site, tous les événements qui ponctuent le site vie</description>";
echo "<url>http //www.zzz.info/feed-icon-28x28.png</url>";
echo "<link>http //www.zzz.info</link>";
echo "</image>";
$typ_art= "and (typ_art= 'Infos' or typ_art= 'Actualites')";
//$typ_art= "and (typ_art = 'Actualites')";
require_once ('admin/mysql_connect.php'); // Connect to the db.
$order_by="date_art desc";
// Make the query. MCC
$query = "SELECT titre, id_art , typ_art, expire, date_art, message, docs, link FROM info
where date_art <= current_date and expire > current_date " .$typ_art . "
ORDER BY $order_by " ;
$result = mysql_query ($query); // Run the qery.
//echo "Result";
//echo $result;
$i=0;
$accents = array("à", "é", "è", "ô", "ù" );
$repl_accents = array("a", "e", "e", "o", "u");
if ($result):
//echo'<p> </p>';
while ($row = mysql_fetch_assoc($result)) :
$exp_date3=explode("-",$row['date_art']);
$exp_date4= $exp_date3 [2]."-".$exp_date3 [1]."-". $exp_date3 [0];
$tmp_title= $row['titre'];
$tmp_title = str_replace($accents, $repl_accents, $tmp_title);
$tmp_title=strtr($tmp_title,'àáâãäçèéêëìíîïñòóôõöùúûüýÿÀÁÂÃÄÇÈÉÊËÌÍÎÏÑÒÓÔÕÖÙÚÛÜÝ', 'aaaaaceeeeiiiinooooouuuuyyAAAAACEEEEIIIINOOOOOUUUUY');
//$tmp_title = mb_convert_encoding( $tmp_title1, "ISO-8859-1", "UTF-8");
//echo $tmp_title."<br/>";
$my_title[$i]=$tmp_title ;
$my_id_art[$i]= $row['id_art'];
$my_message[$i]=substr($row['message'],0,10);
$my_date[$i]=$exp_date4;
$my_id_art[$i]= $row['id_art'];
$i+= 1 ;
//echo "<a href= \\"evenements.php?id_art=". $row['id_art'] . "\\">Lire la suite</a>";
endwhile;
else:
//echo "can't do query ";
endif;
for ( $counter = 0 ; $counter < $i ; $counter += 1) {
$my_link= "<a href= \\"actualites-pharmaceutiques.php?id_art=". $my_id_art[$counter] . "\\"> " . $my_title[$counter] . "</a>";
//echo "<a href= \\"evenements.php?id_art=". $row['id_art'] . "\\"> Lire la suite </a>";
echo "<item>";
//echo "<title>".$my_title[$counter]. ". . . id_art = " .$my_id_art[$counter]."</title>";
//echo "<title>". $my_link ."</title>";
echo "<description><![CDATA[" . ($my_link) . "]]></description>";
//echo "<title>"."title"."</title>";
//echo "<link>http://www.mozaccycloclub.com/evenements.php?id_art=".$my_id_art[$counter]."</link>";
//echo "<description>"."description messages "."</description>";
echo "<pubDate>".$my_date[$counter]."</pubDate>";
echo "</item>";
};
echo "</channel>";
echo "</rss>";
?>