Doyaski:
> Is there a way to have the RSS news
> feeds show up on the Summary page
> along with the list of recent documents
> from the articles page? As it is now, you
> can only read the headlines from the
> feeds if you go to the articles page but
> it seems it would be a good idea to have
> them right there on the summary page
> along with all the other info when people log in.
> Thanks for any suggestions!
Hi. I will give you a quick way to do it. I think your idea is good, maybe I'll add it as a definitive feature in the next release.
First, edit the file cm/cm_lib.inc.php and look for the function fcm_display_txtrdfbox around line 1557. You need to modify that little function (which currently is unused, by the way) and change line 1562:
Code:
...a href=\"../cm/redir.php?cm...
The only change was to add the "../cm/" string to the link, so the RSS links are correctly referenced.
Then, after that function, around line 1568, add the following function:
Code:
function fcm_display_txtsynd ($cm_autodl, $cm_homepage, $cm_displayall) {
$cm_where = "";
if ($cm_autodl) {
$cm_where = "(cmdb_autodl > 0)";
}
if ($cm_homepage) {
if ($cm_where != "") {
$cm_where .= " and (cmdb_inhome > 0)";
}
else {
$cm_where = "(cmdb_inhome > 0)";
}
}
if ($cm_where != "") {
$cm_where = " where " . $cm_where;
}
$result1 = db_query("select cmdb_title, cmdb_visitems, cmdb_autodl, cmdb_inhome from " . CM_DB_PREFIX . "cmsynd3" . $cm_where . " order by upper(cmdb_title)") or db_die();
while ($row1 = db_fetch_row($result1)) {
if ($cm_displayall) {
fcm_display_txtrdfbox ($row1[0], fcm_readrdf ($row1[0], 100, CM_MAX_SYNDLEN));
}
else {
fcm_display_txtrdfbox ($row1[0], fcm_readrdf ($row1[0], $row1[1], CM_MAX_SYNDLEN));
}
}
};
This is really a copy of the fcm_display_synd function, with the difference that this calls the fcm_display_txtrdfbox function we modified before.
Now that the supporting functions are in place, let's edit the cm/cm_summary.inc.php file to call them. Around line 68 (near the end of the file) add the following code:
Code:
echo "<table width=\"$cm_tdwidth\" cellspacing=\"1\" border=\"1\"><tr><td>";
fcm_load_synd (false, true, false);
fcm_display_txtsynd (false, true, false);
echo "</td></tr></table>";
That code just add a table below the documents list with the RSS listings. Of course this is a quick hack. But you get the idea if you need to modify it more to suit your wishes, Doyaski.
Any question, comment or suggestion, please post.
Regards,
Mario A. Valdez-RamÃrez.