m30
New Member
Posts: 11
|
RSS
Aug 18, 2006 2:16:54 GMT -5
Post by m30 on Aug 18, 2006 2:16:54 GMT -5
Right now I'm maintaining an RSS feed to keep readers up-to-date on my lastest posts; However I need to edit the .xml file manually every time I update.
In a perfect world, would we ever be able to have greymatter generate an XML file that would change to mirror the index, and be automatically rebuilt with any new updates?
|
|
|
RSS
Aug 18, 2006 9:17:37 GMT -5
Post by petefinnigan on Aug 18, 2006 9:17:37 GMT -5
Hi, There is a good mod by BanaBob that creates an RSS 1.0 feed from your greymatter posts. I have implemented this mod three time on three different blogs I maintain and it works fine. I have started a Greymatter mods page on my web site to list my own mods and also to point at useful other mods. The RSS feed mod is linked on there. Its also available direct from banabobs site. I seem to remember that there was an ATOM feed and RSS2.0 mod done by someone as well but I cannot find it. The RSS1.0 feed should be fine for you for now. let me know if you need any help. cheers Pete
|
|
|
RSS
Aug 18, 2006 11:43:08 GMT -5
Post by coldstone on Aug 18, 2006 11:43:08 GMT -5
Excellent. I have RSS feeds on my todo list. Seemed like a simple matter with connected files, but I will check this out. I think its a good canidate to include into the GreyMatter core, but what do other people think? I am going to setup a poll for this.
|
|
|
RSS
Aug 18, 2006 14:39:45 GMT -5
Post by petefinnigan on Aug 18, 2006 14:39:45 GMT -5
There was mention on the old forum recently of an RSS2.0 and Atom feed but I cannot for the life of me remember whether someone had actually created one.
I know the RSS1.0 (RDF) and RSS2.0 formats and it should be reletively easy to convert bananbobs code to do RSS2.0 as well. The standard Perl library is able to generate both. The Atom support is done through another Perl library though and to add ATOM support may be harder as I dont beleive atom 1.0 is supportedjust 0.3 I think.
The licence on gm-rss is GPL so we couldnt build it into greymatter as my understanding of the GPL licence is that the whole of greymatter would then be GPL but it already has its own licence and we cannot change that.
There are two options, add rss2 and atom to gm-rss or re-write and build into greymatter completely. The later would have the advantage of making trackbacks and other RPC based stuff easierto add.
What is everyones opinion?
cheers
Pete
|
|
m30
New Member
Posts: 11
|
RSS
Aug 18, 2006 21:14:29 GMT -5
Post by m30 on Aug 18, 2006 21:14:29 GMT -5
For the time being:
Why don't we plan to update the 'gm-rss' that we already have to support RSS 2.0, if that's as easy as Pete says it should be, and integrate that into the 1.6.1 build.
Later on, once we hash out the ATOM support, we can release that as a mod.
If we're shooting for October, I figure that'll take the least time and be the most useful.
|
|
|
RSS
Aug 19, 2006 0:18:09 GMT -5
Post by coldstone on Aug 19, 2006 0:18:09 GMT -5
Petes right about the GPL. Since GM is already licensed, I think we are facing a rewrite to integrate, which I don't think will be a big deal.
Upgrading and posting gm-rss seperately for now seems like a good idea though.
|
|
|
RSS
Aug 20, 2006 16:28:58 GMT -5
Post by petefinnigan on Aug 20, 2006 16:28:58 GMT -5
Hi All,
I will take a look at gm-rss and convert it to do RSS 2.0 as well. I am not sure of whether we should include in the October release as well but I have a couple of other ideas on RSS / Atom
The current gm-rss.pl script has a dependancy on having variables added to the template that are used to trigger the generation of the content for the feed. I am not sure as I have not looked at the gm-rss code to see but it would be better if we removed the need to add variables to the template and also had a parameter that allows gm-rss to:
o - output the whole post or o - output the first xx words (This can be done with gm-rss now and variables) o - output wit comments or not.
Into the future it would be good to be able to also
o - output an RSS feed for a single post rather than the whole blog or at a category level. o - output the same for comments.
basically allow RSS feeds to be added for any area of the blog.
cheers
Pete
|
|
|
RSS
Aug 21, 2006 17:28:33 GMT -5
Post by coldstone on Aug 21, 2006 17:28:33 GMT -5
Just to clarify last two points (end of work day, my apologies) do you mean that people could subscribe to just the comments (or do you mean they could subscribe and not get the comments)? Also, we would need some sort of category device in greymatter for category rss (which seems like a good feature).
|
|
|
RSS
Aug 23, 2006 12:17:05 GMT -5
Post by scottlindberg on Aug 23, 2006 12:17:05 GMT -5
It would be nice if the new RSS could output seperate feeds for each author. I also strongly support not needing to add variables into the templates, as Pete mentioned. Both would be greatly helpful for those of us using Greymatter in a slightly different than "normal" way. The ability for this kind of customization was what brought me to Greymatter way back when.
|
|
|
RSS
Aug 23, 2006 13:13:13 GMT -5
Post by picaman on Aug 23, 2006 13:13:13 GMT -5
Behold: <?php
/****************\ | Site variables | \****************/ class vars { var $mainTitle = "title of site"; // your site's title var $mainDesc = "description of site"; // your site's description var $archivesDir = "/XXX/YYY/ZZZ/blog/archives"; // the archives directory the posts are in var $archivesDirFull = "http://www.yoursite.com/blog/archives"; // URL of the archives directory the posts are in var $mainURL = "http://www.yoursite.com/"; // your site's main URL var $rssImg = "http://www.yoursite.com/favicon.ico"; // your RSS image URL (100x100, or so) var $rssDir = "/XXX/YYY/ZZZ/rss"; // the location to save your RSS files (be sure to set the permissions) var $rssDirFull = "http://www.yoursite.com/rss"; // URL of the RSS directory var $rss1Last = "latest_rss1.xml"; // filename for latest post in RSS 1.O var $rss1List = "list_rss1.xml"; // filename for list of 10 latest posts in RSS 1.O var $rss2Last = "latest_rss2.xml"; // filename for latest post in RSS 2.O var $rss2List = "list_rss2.xml"; // filename for list of 10 latest posts in RSS 2.O var $ext = "php"; // extension for your individual posts var $editorEmail = "name@domain.com"; // Managing Editor's email address var $webmasterEmail = "name@domain.com"; // Webmaster's email address var $cgiDir = "/XXX/YYY/ZZZ/scgi-bin"; // the location of GM var $rssLimit = 15; // the number of entries to show in the list versions }
Function parse($text){ $text = strip_tags($text); $text = substr($text, 0, 100); return $text; }
function writefile($path, $content) { $mode = "w"; if (!$writefile = fopen($path, $mode)) { die('Cannot open file (' . $path . ')'); } if (fwrite($writefile,$content) === FALSE) { die('Cannot write to file (' . $path. '), mode ' . $mode); } fclose($writefile); }
function getlastentry(){ $vars = new vars; // opens the entry list file $entries = file("$vars->cgiDir/gm-entrylist.cgi"); $number = count($entries); $key = 0;
// the loop for going through the entries to find the latest open one for( $i = $number; $i > 0; --$i){ $lines = explode("|",$entries[$key]); $postnum = $lines[0]; $subject = $lines[2]; $open_closed = $lines[5];
// Checks to see if the entry is open. If it isn't, it moves on to the next one. if($open_closed == "O"){ $postnum = str_pad($postnum, 8, "0", STR_PAD_LEFT); $postfile = file("$vars->archivesDir/$postnum.cgi"); // opens the source file for the entry $postfilename = "$vars->archivesDirFull/$postnum.$vars->ext"; $entrytext = $postfile[2]; $entrytext = parse($entrytext); $entrytext = str_replace("|*||*|", "\n\n", $entrytext); $entrytext = str_replace("|*|", "\n", $entrytext); break; } $key--; } $entryarr = array('subject'=>$subject,'text'=>$entrytext,'link'=>$postfilename); return $entryarr; }
function getlistentry(){ $vars = new vars; // opens the entry list file $entries = file("$vars->cgiDir/gm-entrylist.cgi"); $number = count($entries); // setting variables for the loop. $key = 0; $limit = 0; $entryListContent1 = ''; $entryListContent2 = '';
// the loop for going through the entries. // the limit is set high to make sure you get the number of posts you want. for($i = 0; $i < $number; $i++){ $lines = explode("|",$entries[$key]); $postnum = $lines[0]; $subject = $lines[2]; $open_closed = $lines[5];
// checks to see if the entry is open (if not, it'll skip it). if($open_closed == "O"){ $postnum = str_pad($postnum, 8, "0", STR_PAD_LEFT); $postfile = "$vars->archivesDirFull/$postnum.$vars->ext"; $entry_list[$postfile] = $subject; $limit++; } $key++; // limits the number of links to 10. if($limit == $vars->rssLimit) break; }
// displaying the list of entries. foreach($entry_list as $entry_file => $subject) { $entryListContent1 = $entryListContent1 . "\n <item rdf:about=\"$entry_file\">\n <title>$subject</title>\n <link>$entry_file</link>\n </item>\n"; $entryListContent2 = $entryListContent2 . "\n <item>\n <title>$subject</title>\n <link>$entry_file</link>\n <guid isPermaLink=\"true\">$entry_file</guid>\n </item>\n"; } $entryarr = array('rss1'=>$entryListContent1,'rss2'=>$entryListContent2); return $entryarr; }
$vars = new vars; $newentry = getlastentry(); $newentrylist = getlistentry();
//RSS 1.0 //Latest Entry $rsscontent = "<?xml version=\"1.0\"?>\n" . "\n" . "<rdf:RDF\n" . " xmlns:rdf=\"http://www.w3.org/1999/02/22-rdf-syntax-ns#\"\n" . " xmlns=\"http://purl.org/rss/1.0/\">\n" . "\n" . " <channel rdf:about=\"$vars->mainURL\">\n" . " <title>$vars->mainTitle</title>\n" . " <link>$vars->mainURL</link>\n" . " <description>\n" . " $vars->mainDesc\n" . " </description>\n" . " <image rdf:resource=\"$vars->rssImg\" />\n" . " <items>\n" . " <rdf:Seq>\n" . " <rdf:li resource=\"{$newentry['link']}\" />\n" . " </rdf:Seq>\n" . " </items>\n" . " </channel>\n" . "\n" . " <image rdf:about=\"$vars->rssImg\">\n" . " <title>$vars->mainTitle</title>\n" . " <link>$vars->mainURL</link>\n" . " <url>$vars->rssImg</url>\n" . " </image>\n" . "\n" . " <item rdf:about=\"{$newentry['link']}\">\n" . " <title>{$newentry['subject']}</title>\n" . " <link>{$newentry['link']}</link>\n" . " <description>\n" . " {$newentry['text']}...\n" . " </description>\n" . " </item>\n" . "\n" . "</rdf:RDF>"; writefile("$vars->rssDir/$vars->rss1Last", $rsscontent);
//List of last 10 entries $rsscontent = "<?xml version=\"1.0\"?>\n" . "\n" . "<rdf:RDF\n" . " xmlns:rdf=\"http://www.w3.org/1999/02/22-rdf-syntax-ns#\"\n" . " xmlns=\"http://purl.org/rss/1.0/\">\n" . "\n" . " <channel rdf:about=\"$vars->mainURL\">\n" . " <title>$vars->mainTitle</title>\n" . " <link>$vars->mainURL</link>\n" . " <description>\n" . " $vars->mainDesc\n" . " </description>\n" . " <image rdf:resource=\"$vars->rssImg\" />\n" . " <items>\n" . " <rdf:Seq>\n" . " <rdf:li resource=\"{$newentry['link']}\" />\n" . " </rdf:Seq>\n" . " </items>\n" . " </channel>\n" . "\n" . " <image rdf:about=\"$vars->rssImg\">\n" . " <title>$vars->mainTitle</title>\n" . " <link>$vars->mainURL</link>\n" . " <url>$vars->rssImg</url>\n" . " </image>\n" . "{$newentrylist['rss1']}" . "\n" . "</rdf:RDF>"; writefile("$vars->rssDir/$vars->rss1List", $rsscontent);
//RSS 2.0 //Latest Entry $pubDate = date("r"); $rsscontent = "<?xml version=\"1.0\"?>\n" . "<rss version=\"2.0\">\n" . " <channel>\n" . " <title>$vars->mainTitle</title>\n" . " <link>$vars->mainURL</link>\n" . " <description>$vars->mainDesc</description>\n" . " <language>en-us</language>\n" . " <pubDate>$pubDate</pubDate>\n" . "\n" . " <docs>$vars->rssDirFull</docs>\n" . " <generator>Jenius(jenius.phrebh.com)</generator>\n" . " <managingEditor>$vars->editorEmail</managingEditor>\n" . " <webMaster>$vars->webmasterEmail</webMaster>\n" . "\n" . " <item>\n" . " <title>{$newentry['subject']}</title>\n" . " <link>{$newentry['link']}</link>\n" . " <description>{$newentry['text']}...</description>\n" . " <guid isPermaLink=\"true\">{$newentry['link']}</guid>\n" . " </item>\n" . " </channel>\n" . "</rss>"; writefile("$vars->rssDir/$vars->rss2Last", $rsscontent);
//List of last 10 entries $pubDate = date("r"); $rsscontent = "<?xml version=\"1.0\"?>\n" . "<rss version=\"2.0\">\n" . " <channel>\n" . " <title>$vars->mainTitle</title>\n" . " <link>$vars->mainURL</link>\n" . " <description>$vars->mainDesc</description>\n" . " <language>en-us</language>\n" . " <pubDate>$pubDate</pubDate>\n" . "\n" . " <docs>$vars->rssDirFull</docs>\n" . " <generator>Jenius(jenius.phrebh.com)</generator>\n" . " <managingEditor>$vars->editorEmail</managingEditor>\n" . " <webMaster>$vars->webmasterEmail</webMaster>\n" . "{$newentrylist['rss2']}" . " </channel>\n" . "</rss>"; writefile("$vars->rssDir/$vars->rss2List", $rsscontent);
?> Replace the variables, and save as rssgenerator.php in your cgi-bin or scgi-bin, chmod to 755, add water, and you have 2 RSS 2.0 feeds and 2 RSS 1.0 feeds. This was contributed by phrebh on the old board, IIRC. I didn't like the feed, for some reason, so I still use gm-rss and run it through Feedburner. But it does work, and it's a starting point for improvement I suppose.  Jamie
|
|
|
RSS
Aug 23, 2006 13:22:10 GMT -5
Post by picaman on Aug 23, 2006 13:22:10 GMT -5
|
|
|
RSS
Aug 24, 2006 16:12:21 GMT -5
Post by coldstone on Aug 24, 2006 16:12:21 GMT -5
Thanks Jamie, that is a great starting place. Its been a while since I read PHP, but it looks like you just hit that from your browser whenever you need to refresh the feeds?
|
|
|
RSS
Aug 25, 2006 5:34:58 GMT -5
Post by petefinnigan on Aug 25, 2006 5:34:58 GMT -5
Hi Picaman, Yes i was aware of this php feed from prebh. It looks like it could have been based on an earlier work by Dave Bradley. See www.daveches.co.uk/greymatter-to-rss.php. I have found a number of other attempts to create feeds for GM. I am working on modding gm-rss to do rss2 and atom at the moment. I am trying to get the atom to work. rss2 works as its very close to rss1 in terms of using xml::rss. I have been on-site most of the week working so not had a huge amount fo time to progress this this week. I think the php feed generators are simpler to read and to implement but i am sticking with perl and gm-rss for the moment for consistency if nothing else. cheers Pete
|
|
|
RSS
Dec 8, 2006 15:46:44 GMT -5
Post by daveches on Dec 8, 2006 15:46:44 GMT -5
petefinnigan, Thanks for noticing that phreb's code is based on my own from November 2004: you are quite right cos the variables mostly have the same names. Anyway I've updated my code now to convert gm to RSS 2.0 and Atom 1.0 feeds. Hope it's useful. dave Bradley
|
|
|
RSS
Jan 1, 2007 9:32:20 GMT -5
Post by petefinnigan on Jan 1, 2007 9:32:20 GMT -5
Thanks for your post Dave and thanks for the update to the RSS script. I made an update to Banana Bobs Perl script last year to do RDF, RSS2.0 and Atom 0.3. There are problems with this, mostly due to the need to have various modules installed to get it to work. The php route is nice but I would like the RSS / Atom feeds to be built into gm rather than as a seperate perl executable. Also the license on gm-rss doesnt match the rest of gm.
I am going to write RDF, RSS and Atom feed generators directly into the gm code soon and will do it in a similar manner to yourself, i.e. I will use direct file writes and create the xml file myself as i dont want to have to have gm users need to install additional modules. I think other blog software such as wordpress does this as well.
Thanks again
cheers
Pete
|
|