Facebook RSS App

Discussion in 'HOWTO-Related Questions' started by Rockstar, Jun 30, 2008.

  1. Rockstar

    Rockstar New Member

    I've got the app running, working and it looks decent.

    I've read over and over the tutorial for Magpie and I only want five items to appear instead of all the items that appear now from the feed and I just don't understand at all where I put the code:

    $items = array_slice($rss->items, 0, 5);
    Here is what my file looks like:

    //define('MAGPIE_CACHE_DIR', $magpie_cache_dir);
    define('MAGPIE_CACHE_ON', 0);
    //define('MAGPIE_CACHE_AGE', 600);
    $rss = @fetch_rss($feed);
    $fbml .= '
      <meta name="medium" content="blog"/>
      <meta name="title" content="'.htmlspecialchars(strip_tags($rss->channel['title'])).'"/>
      <meta name="description" content="'.htmlspecialchars(strip_tags($rss->channel['description'])).'"/>
      <link rel="target_url" href="'.$rss->channel['link'].'"/>
    foreach ($rss->items as $item) {
            $fbml .= '<div style="border-bottom: 0px solid #CCCCCC; padding-bottom:3px;"><br><div style="border-bottom: 1px dotted #CCCCCC; border-top: 1px dotted #CCCCCC;"><table border="0" width="100%" style="margin: 5px 5px 5px 5px;"><tr><td valign="top" width="1000%"><a href="'.$item['link'].'" style="font-weight: bold;">'.$item['title'].'</a></td><td valign="top" width="100%">
      <meta name="medium" content="blog" />
      <meta name="title" content="'.htmlspecialchars(strip_tags($item['title'])).'" />
      <meta name="description" content="'.htmlspecialchars(strip_tags($item['description'])).'" />
      <link rel="target_url" href="'.$item['link'].'" />
            $fbml .= '</div>';
    $fbml .= '</div>';
    echo $fbml;
  2. Rockstar

    Rockstar New Member

    After further reading I've realized that the

    $items = array_slice($rss->items, 0, 5);
    Doesn't seem to be included in the part where I was trying to put it before.

    Any help would be greatly appreciated. I have NO idea where I put the code to display only five items. The tutorial doesn't say where exactly the code goes, the cookbook for MagpieRSS doesn't make it clear either.

    Any assistance would be greatly appreciated :)

    Forgive my unfamiliarity as this is one of my first times attempting something like this and I'm about to give up.
  3. Rockstar

    Rockstar New Member

    I actually figured it out after searching the forums. I found another thread that doesn't deal with the same problem but with the description length. The solution was to place it in the rss.php file. So I figured I'd try placing my code in that file as well and it worked :)

Share This Page