Facebook Link

Module Tags

Any of the data publicly available from the Graph API can be accessed with this module. To understand the usage and flexibility it is recommended that you spend some time with Facebook's Graph Explorer Tool to explore the particular page you will be displaying data for. Your EE template tags will look something like this...

{exp:fb_link:graph request="you set this"}
some code and variables


The following two parameters are available to be set. At least one of them must be set.


This is the graph object (or objects) you are accessing. This parameter replaces the previous 'graph' parameter.

 request="your FB page?fields=feed" 

You may optionally pass in a custom access token (copied from the CP) if needed. In most cases this is not needed and the default selected token will work fine.


You can specify a limit to the output. This does not affect the number retrieved from the FB graph (for that see the Graph docs at FB) but only limits how many EE will display.


Set to 'yes' to output JSON. Defaults to 'no'.


Graph Explorer

There are numerous variables available. To find out which ones apply to your page utilize the Graph Explorer Tool. Every item in the graph can be accessed by using it's name as a variable with it's "parent" appended to it (see the example below). Graph Explorer returns this: {   "feed": {     "data:" [       {data row one}       {data row two}     ],   } } To read any variable-pair you must add the outer reference to id. Using the data below the Expression Engine template would resemble this: {feed}   {feed:data}     {feed:from}      {from:id}      {from:name}     {/feed:from}     {feed:message}     note that the parent is appended to the variable   /feed:data} {/feed} All of the variables can be used as a standard Expression Engine conditional. The most useful one for a conditional is type.


The permalink variable is not returned by default with the graph data (why Facebook? why?) so it's created for each post. Be sure to change the "parent" to whatever is appropriate for what you are calling (feed, posts, statuses, etc.).



Basic Feed Example

This pulls from the Facebook company page. Change the page ID parameter to whatever page ID you want to pull data from.

{exp:fb_link:graph request="facebook?fields=feed"}
<div style="margin: 10px;">

<p>Posted by {feed:from}{from:name}{/feed:from} on {feed:created_time format="%D, %M %d"}.</p>