Problem with your FaceBook Tutorial

Discussion in 'Programming/Scripts' started by pclark, Dec 1, 2008.

  1. pclark

    pclark New Member

    Firstly, great tutorial!
    I'm trying to make it display only the 5 most recent entries in my facebook application. I've tried doing what the Magpie RSS howto says, but it says:
    my application code is as follows (Line 9 is the custom code, and I've renamed subsequent variables to use the new array, no dice.):
    PHP:
    <?php
    include('conf.php');
    define('MAGPIE_CACHE_DIR'$magpie_cache_dir);
    define('MAGPIE_CACHE_ON'0);
    define('MAGPIE_CACHE_AGE'600);

    require_once(
    'rss/rss_fetch.inc');
    $rss = @fetch_rss($feed);
    $rssitems array_slice($rss->items05);

    $fbml '<fb:header decoration="no_padding">Simply Happy News</fb:header><div style="margin:0 10px 0 10px;">';
    $fbml .= '<table border="0" width="100%" style="margin: 5px 5px 5px 5px;"><tr><td valign="top" width="80%"><a href="'.$rssitems->channel['link'].'" style="font-weight: bold;">'.$rssitems->channel['title'].'</a></td><td valign="top" width="80%"><fb:share-button class="meta">
      <meta name="medium" content="blog"/>
      <meta name="title" content="'
    .htmlspecialchars(strip_tags($rssitems->channel['title'])).'"/>
      <meta name="description" content="'
    .htmlspecialchars(strip_tags($rssitems->channel['description'])).'"/>
      <link rel="target_url" href="'
    .$rssitems->channel['link'].'"/>
    </fb:share-button></td></tr></table>'
    ;



    foreach (
    $rssitems->items as $item) {
            
    $fbml .= '<div style="border-bottom: 2px solid #CCCCCC; padding-bottom:5px;"><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="80%"><a href="'.$item['link'].'" style="font-weight: bold;">'.$item['title'].'</a></td><td valign="top" width="80%"><fb:share-button class="meta">
      <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'].'" />
    </fb:share-button></td></tr></table></div>'
    ;
            if(
    $item['description']) $fbml .= $item['description'];
            
    $fbml .= '</div>';
    }
    $fbml .= '</div>';

    echo 
    $fbml;

    ?>

    Any ideas? Its really frustrating :)
     
  2. falko

    falko Super Moderator ISPConfig Developer

    I'd fill in the following line right after
    Code:
    $rss = @fetch_rss($feed);
    for debugging purposes:
    Code:
    print_r($rss);
    That way you see what's in $rss->items.

    BTW, where did you define $feed?
     

Share This Page