Configuring RSS Feeds

From ARK
Jump to: navigation, search

It is possible to create an RSS feed of any saved filterset. What this means is that you can save a query (for instance, "What contexts have been assigned to Stuart Eve") - and then Subscribe to the RSS export for that saved filterset - which will update your RSS reader with the latest results.

This is quite easy to set-up, but there are some additions you will need to make to your settings file. This is simply a matter of adding an extra array into your export_conf_array in each of the mod_settings (see Exporting_Data for more information about this):

 $RSS_short_desc = $conf_field_short_desc;
 $RSS_short_desc['op_tag_RSSExt'] = 'description';
 $cxt_export_conf = 
   array(
   'CSV' =>
       array(
           'op_field_delimiter' => ',',
           'op_text_delimiter' => ' ',
           'export_fields' =>
               array(
                   $conf_field_issuedon,
                   $conf_field_definition,
               )
           ),
   'XMLItemList' =>
       array('empty'
   ),
   'XMLItem' =>
       array('empty'
   ),
   'RSSExt' =>
       array(
           'export_fields' =>
               array(
                   $RSS_short_desc
               )
           ),
   
 );

You will notice a couple of extra things here. Firstly I am creating a new field in the settings file called RSS_short_desc. The RSS specification requires that a tag called <description> is within any RSS file. This is essentially a short bit of text describing each item. In the example here I am creating a copy of the short_desc field, changing its name and and adding in an extra element to the array 'op_tag_RSSExt'. This tells the RSS code what tags to put around the value of that field.

 $RSS_short_desc = $conf_field_short_desc;
 $RSS_short_desc['op_tag_RSSExt'] = 'description';

I then add the the RSSExt array into the wider export_conf array - to ensure that the RSS export code can read it.

In order to access this feed, you need to know the number of the saved filterset (this can be found in cor_tbl_filter) or in later versions of the code a pre-filled link is provided next to an saved filters.

The RSS feed can be accessed directly by pointing your web browser or RSS reader at:

 http://YOUR_WEB_ADDRESS_HERE/data_view.php?vtok=1&retftrset=9&output=RSSExt

Please note the 'retftrset=9' needs to be replaced with the relevant number for whichever saved filterset you want to have the RSS feed of.

ATOM Feeds

ARK can also output in Atom format, this is similar to the setup of the normal RSS feeds, except the Atom specification requires a couple of extra fields.

Atom requires an 'author' tag, therefore it is important to include an actor field here with the tag 'author'. The content of the Atom feed is held within a wider <content> tag, therefore you should separate the other fields using HTML tags (such as <divs>). Examples of this are below:

 $Atom_short_desc = $conf_field_short_desc;
 $Atom_short_desc['op_tag_AtomExt'] = 'div';
 $Atom_interp = $conf_field_interp;
 $Atom_interp['op_tag_AtomExt'] = 'div';
 $Atom_author = $conf_field_issuedto;
 $Atom_author['op_tag_AtomExt'] = 'author';

And the extra array in the $export_conf (as per RSS above):

 'AtomExt' =>
       array(
           'export_fields' =>
               array(
                   $Atom_short_desc,
                   $Atom_interp,
                   $Atom_author
               )
   ),