RSS for Authors

jyork - March 17, 2008 - 01:35
Project:Bibliography Module
Version:5.x-1.4
Component:Miscellaneous
Category:feature request
Priority:normal
Assigned:Unassigned
Status:active
Description

I have not seen anything about this and I wonder if it would be possible to add RSS feeds to pages that show the works of each Author in the bibliography. I am just learning to write modules so I may be able to work on this if I have an idea of what would need to be done.

Thank you very much,

Jeremy

#1

rjerome - March 25, 2008 - 01:46

Could you clarify, do you mean a separate feed for each author or a feed sorted by author?

I think this would be pretty easy to do if we just add an rss option the the regular author url, so the rss url would be

example.com/biblio/author/jeremy/rss.xml then instead of calling the show results function we would just call a slightly modified version of biblio_feed and that should be all there is to it.

Ron.

#2

rjerome - March 25, 2008 - 02:01

I just added this to the -dev version. It took just a couple of lines of code.

So now you can use a url like http://example.com/biblio/author/jeremy/rss.xml to get the listings for that author.

Ron.

#3

jyork - March 27, 2008 - 02:35

Thank you very much for this, Ron. I'm one of several people I've noticed who are using your module for a university faculty publications hub. This is huge for what we are trying to do and I really appreciate it. I've been going through your code and am having a hard time finding which part relates specifically to this functionality. If you have a minute it would be great if you could direct me to the parts that make it work.

Thank you very much again,

Jeremy

#4

rjerome - March 27, 2008 - 12:39

Hi Jeremy,

Unfortunately, the 5.x branch has developed into a bit of a mess which I'm trying to rectify in the upcoming 6.x version.

That being said, there were only a few changes required, and they were...

In biblio_db_search() at line 2319 I added

        case 'rss.xml':
          $rss = TRUE;
          break;       

This detects the fact that we want an RSS feed.

Then at line 2429 I added this conditional which branches based on the value of $rss

  if ($rss)
  {
  biblio_feed($result, $title);
  }
  else
  {
    return biblio_show_results($result, $pager_attrib, $args,$inline);
  }

So if $rss is true, then we create a feed rather than displaying the results.

Lastly, I made a couple of modifications to biblio_feed() at line 1910. This function used to take no arguments, but I added $result and $title and gave them both default values of NULL so that the function would behave the same as it did without arguments. Now you just pass a db result pointer and a title and a feed is created.

Ron.

#5

jyork - March 27, 2008 - 18:41

Hi Ron,

Thank you very much. I'm starting to get the hang of this, but I'm not quite there yet. I really appreciate your help and all of your work on this module.

Jeremy

 
 

Drupal is a registered trademark of Dries Buytaert.