Welcome to Geeklog, Anonymous Saturday, December 21 2024 @ 11:18 am EST
Geeklog Forums
http://www.morningbuzzonline.com/podcast/themorningbuzz.xml
Santoni
Anonymous
Hello,
I am trying to use the following XML in a Portal Block in GL.
http://www.morningbuzzonline.com/podcast/themorningbuzz.xml
It displays just fine.....but the links goto my GL site....not the podcast they are suppost to goto. What do I need to do to fix this?
Thanks!
I am trying to use the following XML in a Portal Block in GL.
http://www.morningbuzzonline.com/podcast/themorningbuzz.xml
It displays just fine.....but the links goto my GL site....not the podcast they are suppost to goto. What do I need to do to fix this?
Thanks!
9
9
Quote
Status: offline
Dirk
Site Admin
Admin
Registered: 01/12/02
Posts: 13073
Location:Stuttgart, Germany
The entries in the feed simply don't have a <link> - but that's what Geeklog is looking for. So it's displaying the title of an entry with an empty link - which your browser considers a link to your own site.
Not sure if it is normal for podcasts not to have <link> elements. Have to look that up ...
bye, Dirk
Not sure if it is normal for podcasts not to have <link> elements. Have to look that up ...
bye, Dirk
9
10
Quote
Santoni
Anonymous
Anyway I can hack the code to display this podcast link?
7
10
Quote
Status: offline
THEMike
Forum User
Moderator
Registered: 07/25/03
Posts: 141
Location:Sheffield, UK
To fully fix this, you need to patch rss.feed.class.php in system/classes/syndication and lib-common.php.
Also, if you want to resolve a sort-of-bug that this has shown up, you'll need to add a new language entry to a language array.
Firstly, here is a patch for rss.feed.class.php as a unified diff:
--- O:\development\geeklog\geeklog-dev\system\classes\syndication\rss.feed.class.php Thu Feb 14 18:17:28 2008
+++ O:\development\geeklog\geeklog-1.x\system\classes\syndication\rss.feed.class.php Thu Mar 09 18:15:06 2006
@@ -433,9 +433,6 @@
} else {
$this->_permaLink = false;
}
- } else if( ($name == 'ENCLOSURE') && array_key_exists('URL', $attributes) ) {
- /* If we have an enclosure with a URL, remember it because this is a podcast */
- $this->_currentItem['enclosureurl'] = $attributes['URL'];
} else {
$this->_permaLink = false;
}
Secondly, in lib-common.php you'll need to replace COM_rdfImport with this version:
/**
* Syndication import function. Imports headline data to a portal block.
*
* Rewritten December 19th 2004 by Michael Jervis (mike@*censored*ingbrit.com). Now
* utilises a Factory Pattern to open a URL and automaticaly retreive a feed
* object populated with feed data. Then import it into the portal block.
*
* @param string $bid Block ID
* @param string $rdfurl URL to get content from
* @param int $maxheadlines Maximum number of headlines to display
* @return void
* @see function COM_rdfCheck
*
*/
function COM_rdfImport($bid, $rdfurl, $maxheadlines = 0)
{
global $_CONF, $_TABLES, $LANG21;
// Import the feed handling classes:
require_once $_CONF['path_system']
. '/classes/syndication/parserfactory.class.php';
require_once $_CONF['path_system']
. '/classes/syndication/feedparserbase.class.php';
$result = DB_query("SELECT rdf_last_modified, rdf_etag FROM {$_TABLES['blocks']} WHERE bid = $bid");
list($last_modified, $etag) = DB_fetchArray($result);
// Load the actual feed handlers:
$factory = new FeedParserFactory($_CONF['path_system']
. '/classes/syndication/');
$factory->userAgent = 'Geeklog/' . VERSION;
if (!empty($last_modified) && !empty($etag)) {
$factory->lastModified = $last_modified;
$factory->eTag = $etag;
}
// Aquire a reader:
$feed = $factory->reader($rdfurl, $_CONF['default_charset']);
if ($feed) {
/* We have located a reader, and populated it with the information from
* the syndication file. Now we will sort out our display, and update
* the block.
*/
if ($maxheadlines == 0) {
if (!empty($_CONF['syndication_max_headlines'])) {
$maxheadlines = $_CONF['syndication_max_headlines'];
} else {
$maxheadlines = count($feed->articles);
}
}
$update = date('Y-m-d H:i:s');
$last_modified = '';
if (!empty($factory->lastModified)) {
$last_modified = addslashes($factory->lastModified);
}
$etag = '';
if (!empty($factory->eTag)) {
$etag = addslashes($factory->eTag);
}
if (empty($last_modified) || empty($etag)) {
DB_query("UPDATE {$_TABLES['blocks']} SET rdfupdated = '$update', rdf_last_modified = NULL, rdf_etag = NULL WHERE bid = '$bid'");
} else {
DB_query("UPDATE {$_TABLES['blocks']} SET rdfupdated = '$update', rdf_last_modified = '$last_modified', rdf_etag = '$etag' WHERE bid = '$bid'");
}
$charset = COM_getCharset();
// format articles for display
$readmax = min($maxheadlines, count($feed->articles));
for ($i = 0; $i < $readmax; $i++) {
if (empty($feed->articles[$i]['title'])) {
$feed->articles[$i]['title'] = $LANG21[61];
}
if ($charset == 'utf-8') {
$title = $feed->articles[$i]['title'];
} else {
$title = utf8_decode($feed->articles[$i]['title']);
}
if ($feed->articles[$i]['link'] != '') {
$content = COM_createLink($title, $feed->articles[$i]['link']);
} elseif ($feed->articles[$i]['enclosureurl'] != '') {
$content = COM_createLink($title, $feed->articles[$i]['enclosureurl']);
} else {
$content = $title;
}
$articles[] = $content;
}
// build a list
$content = COM_makeList($articles, 'list-feed');
$content = preg_replace("/(\015\012)|(\015)|(\012)/", '', $content);
if (strlen($content) > 65000) {
$content = $LANG21[68];
}
// Standard theme based function to put it in the block
$result = DB_change($_TABLES['blocks'], 'content',
addslashes($content), 'bid', $bid);
} else if ($factory->errorStatus !== false) {
// failed to aquire info, 0 out the block and log an error
COM_errorLog("Unable to aquire feed reader for $rdfurl", 1);
COM_errorLog($factory->errorStatus[0] . ' ' .
$factory->errorStatus[1] . ' ' .
$factory->errorStatus[2]);
$content = addslashes($LANG21[4]);
DB_query("UPDATE {$_TABLES['blocks']} SET content = '$content', rdf_last_modified = NULL, rdf_etag = NULL WHERE bid = $bid");
}
}
Then you'll need to add a 68'th entry to $LANG21 (there may not be 67 entries in 1.4.1, but there are in 1.5CVS so it's best to stay forward compatible with this...)
68 => 'The feed for this portal block is too long to display. Please set a maximum number of articles to import for the block in the block setup screen, or a global maximum in Geeklog Configuration.'
This then works so that if a podcast has no link it hyperlinks the enclosure instead. Of course if the podcast does have a link, it still displays that.
Also, if you want to resolve a sort-of-bug that this has shown up, you'll need to add a new language entry to a language array.
Firstly, here is a patch for rss.feed.class.php as a unified diff:
Text Formatted Code
--- O:\development\geeklog\geeklog-dev\system\classes\syndication\rss.feed.class.php Thu Feb 14 18:17:28 2008
+++ O:\development\geeklog\geeklog-1.x\system\classes\syndication\rss.feed.class.php Thu Mar 09 18:15:06 2006
@@ -433,9 +433,6 @@
} else {
$this->_permaLink = false;
}
- } else if( ($name == 'ENCLOSURE') && array_key_exists('URL', $attributes) ) {
- /* If we have an enclosure with a URL, remember it because this is a podcast */
- $this->_currentItem['enclosureurl'] = $attributes['URL'];
} else {
$this->_permaLink = false;
}
Secondly, in lib-common.php you'll need to replace COM_rdfImport with this version:
Text Formatted Code
/**
* Syndication import function. Imports headline data to a portal block.
*
* Rewritten December 19th 2004 by Michael Jervis (mike@*censored*ingbrit.com). Now
* utilises a Factory Pattern to open a URL and automaticaly retreive a feed
* object populated with feed data. Then import it into the portal block.
*
* @param string $bid Block ID
* @param string $rdfurl URL to get content from
* @param int $maxheadlines Maximum number of headlines to display
* @return void
* @see function COM_rdfCheck
*
*/
function COM_rdfImport($bid, $rdfurl, $maxheadlines = 0)
{
global $_CONF, $_TABLES, $LANG21;
// Import the feed handling classes:
require_once $_CONF['path_system']
. '/classes/syndication/parserfactory.class.php';
require_once $_CONF['path_system']
. '/classes/syndication/feedparserbase.class.php';
$result = DB_query("SELECT rdf_last_modified, rdf_etag FROM {$_TABLES['blocks']} WHERE bid = $bid");
list($last_modified, $etag) = DB_fetchArray($result);
// Load the actual feed handlers:
$factory = new FeedParserFactory($_CONF['path_system']
. '/classes/syndication/');
$factory->userAgent = 'Geeklog/' . VERSION;
if (!empty($last_modified) && !empty($etag)) {
$factory->lastModified = $last_modified;
$factory->eTag = $etag;
}
// Aquire a reader:
$feed = $factory->reader($rdfurl, $_CONF['default_charset']);
if ($feed) {
/* We have located a reader, and populated it with the information from
* the syndication file. Now we will sort out our display, and update
* the block.
*/
if ($maxheadlines == 0) {
if (!empty($_CONF['syndication_max_headlines'])) {
$maxheadlines = $_CONF['syndication_max_headlines'];
} else {
$maxheadlines = count($feed->articles);
}
}
$update = date('Y-m-d H:i:s');
$last_modified = '';
if (!empty($factory->lastModified)) {
$last_modified = addslashes($factory->lastModified);
}
$etag = '';
if (!empty($factory->eTag)) {
$etag = addslashes($factory->eTag);
}
if (empty($last_modified) || empty($etag)) {
DB_query("UPDATE {$_TABLES['blocks']} SET rdfupdated = '$update', rdf_last_modified = NULL, rdf_etag = NULL WHERE bid = '$bid'");
} else {
DB_query("UPDATE {$_TABLES['blocks']} SET rdfupdated = '$update', rdf_last_modified = '$last_modified', rdf_etag = '$etag' WHERE bid = '$bid'");
}
$charset = COM_getCharset();
// format articles for display
$readmax = min($maxheadlines, count($feed->articles));
for ($i = 0; $i < $readmax; $i++) {
if (empty($feed->articles[$i]['title'])) {
$feed->articles[$i]['title'] = $LANG21[61];
}
if ($charset == 'utf-8') {
$title = $feed->articles[$i]['title'];
} else {
$title = utf8_decode($feed->articles[$i]['title']);
}
if ($feed->articles[$i]['link'] != '') {
$content = COM_createLink($title, $feed->articles[$i]['link']);
} elseif ($feed->articles[$i]['enclosureurl'] != '') {
$content = COM_createLink($title, $feed->articles[$i]['enclosureurl']);
} else {
$content = $title;
}
$articles[] = $content;
}
// build a list
$content = COM_makeList($articles, 'list-feed');
$content = preg_replace("/(\015\012)|(\015)|(\012)/", '', $content);
if (strlen($content) > 65000) {
$content = $LANG21[68];
}
// Standard theme based function to put it in the block
$result = DB_change($_TABLES['blocks'], 'content',
addslashes($content), 'bid', $bid);
} else if ($factory->errorStatus !== false) {
// failed to aquire info, 0 out the block and log an error
COM_errorLog("Unable to aquire feed reader for $rdfurl", 1);
COM_errorLog($factory->errorStatus[0] . ' ' .
$factory->errorStatus[1] . ' ' .
$factory->errorStatus[2]);
$content = addslashes($LANG21[4]);
DB_query("UPDATE {$_TABLES['blocks']} SET content = '$content', rdf_last_modified = NULL, rdf_etag = NULL WHERE bid = $bid");
}
}
Then you'll need to add a 68'th entry to $LANG21 (there may not be 67 entries in 1.4.1, but there are in 1.5CVS so it's best to stay forward compatible with this...)
Text Formatted Code
68 => 'The feed for this portal block is too long to display. Please set a maximum number of articles to import for the block in the block setup screen, or a global maximum in Geeklog Configuration.'
This then works so that if a podcast has no link it hyperlinks the enclosure instead. Of course if the podcast does have a link, it still displays that.
7
6
Quote
still need a little help
Anonymous
Hello,
Thanks for the help....I have placed all the code into the files....but it still isn't working. Where exactly should the patch for rss.feed.class.php be placed?
Thanks for the help....I have placed all the code into the files....but it still isn't working. Where exactly should the patch for rss.feed.class.php be placed?
7
9
Quote
An error
Anonymous
I decided to 'rebuild' the block after I made the changes....and when I saved the block I got the following error:
Unknown column 'rdf_last_modified' in 'field list'.
Unknown column 'rdf_last_modified' in 'field list'.
6
7
Quote
Just an FYI
Anonymous
I am using Version 1.4.1
7
9
Quote
Just an FYI
Anonymous
How can I retro fit the patch?
10
5
Quote
Status: offline
THEMike
Forum User
Moderator
Registered: 07/25/03
Posts: 141
Location:Sheffield, UK
Ah didn't realise that had changed in 1.5.
In the COM_rdfImport function find:
$content = COM_createLink($title, $feed->articles[$i]['link']);
and replace with:
if ($feed->articles[$i]['link'] != '') {
$content = COM_createLink($title, $feed->articles[$i]['link']);
} elseif ($feed->articles[$i]['enclosureurl'] != '') {
$content = COM_createLink($title, $feed->articles[$i]['enclosureurl']);
} else {
$content = $title;
}
In the COM_rdfImport function find:
Text Formatted Code
$content = COM_createLink($title, $feed->articles[$i]['link']);
and replace with:
Text Formatted Code
if ($feed->articles[$i]['link'] != '') {
$content = COM_createLink($title, $feed->articles[$i]['link']);
} elseif ($feed->articles[$i]['enclosureurl'] != '') {
$content = COM_createLink($title, $feed->articles[$i]['enclosureurl']);
} else {
$content = $title;
}
7
10
Quote
Status: offline
THEMike
Forum User
Moderator
Registered: 07/25/03
Posts: 141
Location:Sheffield, UK
Quote by: still need a little help
Hello,
Thanks for the help....I have placed all the code into the files....but it still isn't working. Where exactly should the patch for rss.feed.class.php be placed?
It's a patch file it should be applied with a patching tool.
Or in rss.feed.class.php find:
Text Formatted Code
} else {
$this->_permaLink = false;
}
} else {
$this->_permaLink = false;
}
And replace with:
Text Formatted Code
} else {
$this->_permaLink = false;
}
} else if( ($name == 'ENCLOSURE') && array_key_exists('URL', $attributes) ) {
/* If we have an enclosure with a URL, remember it because this is a podcast */
$this->_currentItem['enclosureurl'] = $attributes['URL'];
} else {
$this->_permaLink = false;
}
9
6
Quote
Status: offline
jmucchiello
Forum User
Full Member
Registered: 08/29/05
Posts: 985
Quote by: THEMike
$content = COM_createLink($title, $feed->articles[$i]['link']);
Ah didn't realise that had changed in 1.5.
In the COM_rdfImport function find:
Text Formatted Code
$content = COM_createLink($title, $feed->articles[$i]['link']);
COM_createLink is also a GL 1.5 function that doesn't exist in 1.4.1
search for:
Text Formatted Code
$content = '<a href="' . $feed->articles[$i]['link'] . '">'. $title . '</a>';
$articles[] = $content;
and replace with:
Text Formatted Code
if ($feed->articles[$i]['link'] != '') {
$content = '<a href="' . $feed->articles[$i]['link'] . '">'
. $title . '</a>';
} elseif ($feed->articles[$i]['enclosureurl'] != '') {
$content = '<a href="' . $feed->articles[$i]['enclosureurl'] . '">'
. $title . '</a>';
} else {
$content = $title;
}
$articles[] = $content;
7
8
Quote
Santoni
Anonymous
Hi guys,
Thanks for the help but I still cant seem to get it working. Would it be easier to write a simple php script that will replace the issue and write to a new xml file? If so, does anyone know where I can get such a script? I am not sure how to go about writing one.
Thanks again
Thanks for the help but I still cant seem to get it working. Would it be easier to write a simple php script that will replace the issue and write to a new xml file? If so, does anyone know where I can get such a script? I am not sure how to go about writing one.
Thanks again
8
13
Quote
All times are EST. The time is now 11:18 am.
- Normal Topic
- Sticky Topic
- Locked Topic
- New Post
- Sticky Topic W/ New Post
- Locked Topic W/ New Post
- View Anonymous Posts
- Able to post
- Filtered HTML Allowed
- Censored Content