the Forum

Adding Facebook Feeds to you Expression Engine site

Posted on July 8, 2011 by Michael Rosario
Total Posts: 33  |  Join date: 03-12-11

We needed to add facebook statuses to our site, and we had access to Facebook Pages’s RSS feed.

So here’s the steps:

  1. Get the RSS feed from Facebook. It looks like:
    http://www.facebook.com/feeds/page.php?id=[YOUR_NUMBER]&format=rss20
  2. Use Magpie plugin, for more details go to:
    http://expressionengine.com/downloads/details/magpie_rss_atom_parser/
  3. Enable PHP on the template

Here is the code:

<?  $list “”?></p>

{exp:magpie url=”http://www.facebook.com/feeds/page.php?id={YOUR_ID_NUMBER}&format=rss20” limit=”11” refresh=”720”}
    
{items}
        <? 
            $pubDate
“{pubdate}”// Get the date
            
$title “”.”“// Get the title
            
$pubDate strftime(%m/%d”strtotime($pubDate)); //Parse the date
        
?>
        <? 
              
if(strlen($title) != 1)//check if title is empty
                  
$list .= </p>

<
dl><dt><b>$pubDate.</b> - .$title.</dt></dl>

<
p>
              
};
          
?>
    {
/items}
{
/exp:magpie}</p>

<
p><? echo $list?> // Display Output 

Tags: There are no tags for this entry.

There are no answers yet.  Add yours below.

add your answers here
comments powered by Disqus