rewrite xml generation

This commit is contained in:
Piotr KUCHARSKI 2014-11-26 21:47:38 +01:00
parent 4a36279803
commit 5b92a64179

39
rss.php
View file

@ -122,33 +122,22 @@ if (($current_time - $last_rss_gen) > $rss_refresh_interval && file_exists("rss.
file_put_contents($old_files_list, $content); file_put_contents($old_files_list, $content);
unlink("rss.locker"); unlink("rss.locker");
} }
/*===================*/ /*===================*/
/* XML Gen */ /* XML Gen */
/*===================*/ /*===================*/
$temp = explode("\n", $temp); $temp = explode("\n", $temp);
$pieceOfTitle; echo "<rss version='2.0'>\n<channel>";
$titleLenght; echo "<title>$title</title>";
echo " echo "<link>$gallery_link</link>";
<rss version=\"2.0\"> echo "<description>$description</description>\n";
<channel> for ($i=0; $i < $nb_items_rss && $i < count($temp); $i++) {
<title>".$title."</title> if (empty($temp[$i]))
<link>".$gallery_link."</link> continue;
<description>".$description."</description> echo "<item>\n";
"; echo " <title>" . basename($temp[$i]) . "</title>\n";
for ($i=0; $i < $nb_items_rss; $i++) { echo " <link>". $temp[$i] . "</link>\n";
$pieceOfTitle = strrchr ($temp[$i] , "/"); echo " <description><![CDATA[ <img src='" . $temp[$i] . "'> ]]></description>\n";
$titleLenght = strlen($pieceOfTitle) - strlen(strrchr($pieceOfTitle, ".")); echo "</item>\n";
echo "<item>
<title>" . substr($pieceOfTitle, 1, $titleLenght-1) . "</title>
<link>". $temp[$i] . "</link>
<description>
<![CDATA[ <img src=\"" . $temp[$i] . "\"> ]]>
</description>
</item>";
if ($temp[$i+1] == NULL)
break;
} }
echo " echo "</channel></rss>\n";
</channel>
</rss>
";