mariovaldez.net

MV.net forums
It is currently 14 Jul 2016, 01:00

All times are UTC - 7 hours




Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 posts ] 
Author Message
 Post subject: RSS feeds
PostPosted: 14 Jul 2004, 00:20 
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!


Report this post
Top
  
Reply with quote  
PostPosted: 14 Jul 2004, 04:02 
User avatar

Joined: 06 Mar 2003, 03:21
Posts: 447
Location: Monterrey, NL, Mexico
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. :D

Regards,

Mario A. Valdez-Ramírez.


Report this post
Top
 Profile  
Reply with quote  
 Post subject: re: RSS Feeds
PostPosted: 14 Jul 2004, 11:16 
Wow! What a fast response Mario....and it works just beautifully! Thanks so much!!


Report this post
Top
  
Reply with quote  
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 posts ] 

All times are UTC - 7 hours


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB® Forum Software © phpBB Group