Pixelpost

Authentic Photoblog Flavour


Go Back   Pixelpost Forum > SUPPORT / INFORMATION > Pixelpost Help

Post Reply
 
Thread Tools
  #1  
Old 02-05-2005, 12:16 AM
jus Offline
forum loafer
 
Join Date: Jan 2005
Location: Hove, UK
Posts: 15
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);
I tried to change the desc to asc in the query order section, and it just took the first 7 posts I ever made. So, can it pull the same 7 records, but in reverse order?

Thanks for any help!
Reply With Quote
  #2  
Old 02-05-2005, 12:55 PM
jus Offline
forum loafer
 
Join Date: Jan 2005
Location: Hove, UK
Posts: 15
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;
}
it's a slightly editted version of the code shown on other pages, i've just added some CDATA tags around the bits i have html in, and i've got it to feed the full size image, rather than a thumbnail - easily changed, the original is just // marked out

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...
Reply With Quote
  #3  
Old 02-05-2005, 01:57 PM
ESN Offline
forum loafer
 
Join Date: Nov 2004
Posts: 15
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
Reply With Quote
  #4  
Old 02-05-2005, 10:06 PM
jus Offline
forum loafer
 
Join Date: Jan 2005
Location: Hove, UK
Posts: 15
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?
Reply With Quote
Post Reply


Thread Tools




All times are GMT. The time now is 09:02 AM.

Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd. | Style Design: d3 designs