Tuttinova
[ class tree: Tuttinova ] [ index: Tuttinova ] [ all elements ]

Class: Nova

Source Location: /Nova.php

Class Overview


Nova class


Author(s):

Methods


Inherited Variables

Inherited Methods


Class Details

[line 23]
Nova class

This class exposes the Tuttinova API to user-space code. It wraps a small subset of the Tuttinova backend, thus offering a lightweight interface for retrieving news and displaying them on the user's own web pages. Convenient RSS generation is provided as well.




Tags:

access:  public
author:  Olivier Guilyardi <mailto:olivier@xung.org>


[ Top ]


Class Methods


constructor Nova [line 40]

Nova Nova( [mixed $topicSpec = ''])

Constructor



Tags:

access:  public


Parameters:

mixed   $topicSpec   Either a single topic name as a string, or multiple topics as an array in order to mix news from several topics in the retrieving process

[ Top ]

method fetch [line 78]

array fetch( integer $num, [integer $ofs = 0])

Fetch recent news

Will fetch $num news from the most recent ones, ordered by date, descending. If $ofs is specified, news will be retrieved from position $ofs, starting from 0.




Tags:

return:  A 2D array containing each news as an associative array
access:  public


Parameters:

integer   $num   The number of news to fetch
integer   $ofs   Optional offset to start fetching from (zero based)

[ Top ]

method fetchRSS [line 161]

string fetchRSS( integer $howMany, [integer $offset = 0], [array $tags = array()])

Fetch recent news as preformatted RSS items

Generate RSS items from the $howMany most recent news. Note that this method produces RSS items as enclosed by <item> and </item>. It is up to you to set up a complete feed by including these items into a RSS document (<rss>, <channel>, and so on).

If $offset is specified, news will be retrieved from position $offset, starting from 0.

RSS tags generation can be customized with the $tags argument. This is an array of the form : array('tagName' => 'content', etc...). Defaults are provided to generate the title, description, dc:creator and dc:date tags. You may at least want to customize the link tag as in:


1 $tags = array('link' => 'http://www.yourwebsite.com/single.php?id={id}');
2 $rssItems = $nova->fetchRSS (10, 0, $tags);

The {id} expression in the example above will be replaced by the corresponding news data ID value. You may use such expressions (as {subject}, {whatever}, etc...) to generate any kind of RSS tags.




Tags:

return:  Formatted RSS items
access:  public


Parameters:

integer   $howMany   The number of news to fetch
integer   $offset   Position to start fetching from, zero-based
array   $tags   RSS tag to content translation

[ Top ]

method fetchSingle [line 118]

array fetchSingle( string $id)

Fetch a single news

Will fetch the news identified by $id. The id in question is the one generated by the Nova::fetch() method for each retrieved news.




Tags:

return:  A single news as an associative array
access:  public


Parameters:

string   $id   The unique news ID as generated by Nova::fetch() or Nova::fetchRSS()

[ Top ]


Documentation generated on Tue, 21 Sep 2004 22:58:44 +0200 by phpDocumentor 1.2.3