Twitter Feed

Xataface Maillist

Sign up to receive the Xataface news letter with weekly updates and development tips.

 
Found 1 of 138 records in table Wiki
Now Showing 1 of 1

Current Record: getFeedItem

getFeedItem

[Permalink]

getFeedItem() Delegate Class Method

Synopsis:

The getFeedItem() method of a table delegate class returns an associative array of parameters for a record as it should appear as part of an RSS feed. An RSS feed item consists of the following components:

  1. title - The title of the record as it appears in the RSS feed.
  2. description - The description of the record for the RSS feed. This is really the body of the RSS feed item.
  3. link - The linkback URL if users want to know more about the record.
  4. date - The date that the record was posted/modified.
  5. author - The name of the person who posted this record.
  6. source - URL to the site where record originated from.

Parameters

  1. Dataface_Record &$record - The record that is being represented in an RSS feed.

Return Value

The getFeedItem() method returns an associative array with the components of the RSS feed. This array does not need to contain all possible keys, or even any keys. Any keys that are omitted will simply use default values in the RSS feed. The array may contain the following keys:

Name Description Version
title The record title as it appears in RSS feeds. If this is omitted, the RSS feed will simply use the output of Dataface_Record's getTitle() method. 1.0
description The record description. This is used in the main body of the RSS feed. If this is omitted, the RSS feed will use an HTML table that shows all of the field data in the record. This value can also be overridden using the getRSSDescription? method of the delegate class. 1.0
link The URL to this record. If this is omitted it just points to the view tab for this record. However you can direct it anywhere you like. When the user clicks on the "More Info" link in his RSS reader it will direct him to this link. 1.0
date The date that this record was posted or last modified. This is the date that an RSS reader will use to decide if it has already loaded the record yet. If this is omitted it will try the Dataface_Record's getLastModified() method to obtain the last modified date of the record. Failing that, it will use Dataface_Record's getCreated() method to try to obtain the creation date of the record. This date should be a unix timestamp. 1.0
author The name of the user who posted this record. If this is omitted, then it will try to use Dataface_Record's getCreator() method. Failing that, it will use the value of the default_author parameter in the [_feed] section of the conf.ini file. If that is not defined, then it simply uses the string "Site Administrator". 1.0
source The source URL where the feed is to have originated. If none is specified, then it will use the value of the source parameter in the [_feed] section of the conf.ini file. Failing that, it will simply use the URL to the application.

Note that you can alternatively define this value using the getFeedSource? method.

1.0

Example

function getFeedItem(&$record){
    return array(
        'title' => "News Item: ".$record->getTitle(),
        'description' => $record->display('News Body'),
        'link' => $record->getPublicLink(),
        'date' => strtotime($record->val('last_modified')),
        'author' => $record->val('posted_by'),
        'source' => 'http://www.example.com'
    );
}

Note that RSS feeds will work perfectly well without defining this method. This just allows you to customize one or more parameters of the RSS feed.

See Also:

blog comments powered by Disqus
Powered by Xataface
(c) 2005-2018 All rights reserved