|
Mambo - Adding timestamps to Mambo RSS feeds. |
|
|
|
|
Written by Frotz
|
|
Wednesday, 30 November 2005 |
This is a one-line hack to the com_rss component. There is an associated small hack in ROOT/includes/feedcreator.class.php
Problem:
The Mambo RSS component generates RSS feeds for the front-page items WITHOUT timestamps.
Solution:
NOTE: This solution adds MySQL specific SQL functions to the Mambo RSS component. If you decided to run against a different back-end, you will need to find the equivalent function that returns a Unix time_t value for the created and modified columns.
- In ROOT/components/com_rss/rss.php, at line 184, change the SQL statement from:
$query = "SELECT a.*, u.name AS author, u.usertype"
to this:
$query = "SELECT a.*, UNIX_TIMESTAMP(a.created) AS created_t, UNIX_TIMESTAMP(a.modified) AS modified_t, u.name AS author, u.usertype"
- In ROOT/components/com_rss/rss.php, at lines 232-46, at the "$item-date" line:
// load individual item creator class
$item = new FeedItem();
// item info
$item->date = ($row->modified_t > 0) ? $row->modified_t : $row->created_t;
$item->title = $item_title;
$item->link = $item_link;
$item->description = $item_description;
$item->source = $info[ 'link' ];
// loads item info into rss array
$rss->addItem( $item );
- In ROOT/includes/feedcreated.class.php, Change the FeedDate constructor (lines 700-769). Specifically change this line from:
$this->unix = 0;
to this line:
$this->unix = $dateString;
Your feeds will now include a timestamp of either your article creation time or the most recent modification time. Adjust the $item->date expression if you only want to reflect the original creation time. |
|
Last Updated ( Thursday, 18 May 2006 )
|