|
#1
|
|||
|
|||
|
more rss
I've got my rss feed to validate now, through using CDATA tags to surround all the parts using any html. I've got my last 7 entries on the feed. I'd like the newest of the 7 to be at the top. At the moment, it's the oldest.
I don't have any experience with SQL, so if anyone can suggest how to put this right.... I think that this is the code concerned... Code:
$query = mysql_query("select id,datetime,headline,body,image from ".$pixelpost_db_prefix."pixelpost where (datetime<='$cdate') order by datetime desc limit 0,7");
while(list($id,$datetime,$headline,$body,$image) = mysql_fetch_row($query)) {
$headline = pullout($headline);
$body = pullout($body);
// $image = $cfgrow['siteurl']."thumbnails/thumb_$image";
$image = $cfgrow['siteurl']."images/$image";
$datetime = strtotime($datetime);
$datetime = date("r",$datetime);
$body = stripslashes($body);
$body = htmlentities($body);
$body = ereg_replace("\n","<br />",$body);
Thanks for any help! |
|
#2
|
|||
|
|||
|
got it worked out - it was the way i had the rss reader configured - stupid or what! that's how new i am to rss though...
if anyone's interested, this is the rss feed that validates and works in firefox and rssreader... Code:
if($_GET['x'] == "rss") {
$output = "<?xml version=\"1.0\" encoding=\"ISO-8859-15\"?>
<rss version=\"2.0\">
<channel>
<title>".$cfgrow['sitetitle']."</title>
<link>".$cfgrow['siteurl']."</link>
<description>".$cfgrow['sitetitle']." photoblog</description>
<docs>http://blogs.law.harvard.edu/tech/rss</docs>
<generator>pixelpost</generator>";
$query = mysql_query("select id,datetime,headline,body,image from ".$pixelpost_db_prefix."pixelpost where (datetime<='$cdate') order by datetime desc limit 0,7");
while(list($id,$datetime,$headline,$body,$image) = mysql_fetch_row($query)) {
$headline = pullout($headline);
$body = pullout($body);
// $image = $cfgrow['siteurl']."thumbnails/thumb_$image";
$image = $cfgrow['siteurl']."images/$image";
$datetime = strtotime($datetime);
$datetime = date("r",$datetime);
$body = stripslashes($body);
$body = htmlentities($body);
$body = ereg_replace("\n","<br />",$body);
$output .= "
<item>
<title><![CDATA[ $headline]]></title>
<link>".$cfgrow['siteurl']."?showimage=$id</link>
<description><![CDATA[ <img src=\"$image\" style=\"align:center;\" /><br /> $body ]]></description>
<pubDate>$datetime</pubDate>
</item>";
}
$output .= "
</channel>
</rss>";
header("Content-type:application/rss+xml");
echo $output;
exit;
}
clicking on the rss link still generates a file that browsers want to download, but if you copy the rss link http://mysite.com/blogdir/?x=rss into the newsreader program, it seems to work just fine. I've noticed that this is the way most of the MT based sites work too. If they produce a browser full of XML, it's reassuring that it's doing something better than a download, bujt it's not. it's the URL for the feed that i just mentioned that the readers need. sorry it's lengthy, but there have been a few posts about this, so I hope it's some use to someone... |
|
#3
|
|||
|
|||
|
Remember to add the <lastBuildDate> TAG to make it even better.
check out my post on http://www.pixelpost.org/forum/viewtopic.php?t=293
__________________
http://photoblog.x123.info |
|
#4
|
|||
|
|||
|
thanks ESN - the code that you put in that thread is where 99.5% of the above came from - nice one.
I shouldn't have started a new thread on this really, can a mod stick these posts onto a common RSS thread? |
| Post Reply |
| Thread Tools | |
|
|