Facebook Link

Examples

Below are some examples to help you see how the module tags should be used. This will hopefully get you started. Be sure and replace "your_page" with your actually page name or ID.

Basic Feed Example

This pulls the feed from your page. Change the page ID parameter to whatever page ID you want to pull data from.

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

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

{if feed:type == 'link'}
<p><a href="{feed:link}">{feed:name}</a></p>
<p>{feed:message}</p>
<p>Posted by {feed:from}{from:name}{/feed:from} on {feed:created_time format="%D, %M %d"}.</p>
{/if}

{if feed:type == 'video'}
<p><a href="{feed:link}">{feed:name}</a></p>
<p><a href="{feed:link}"><img src="{feed:picture}"></a></p>
<p>Posted by {feed:from}{from:name}{/feed:from} on {feed:created_time format="%D, %M %d"}.</p>
{/if}

{if feed:type == 'photo'}
<p><a href="{feed:link}"><img src="{feed:picture}"></a></p>
<p>{feed:message}</p>
<p>Posted by {feed:from}{from:name}{/feed:from} on {feed:created_time format="%D, %M %d"}.</p>
{/if}

</div>
{/feed:data}
{/feed}
{/exp:fb_link:graph}

Statuses Example

This pulls only the statuses posted to a page.

{exp:fb_link:graph request="your_page?fields=statuses"}
{statuses}
{statuses:data}
your HTML formatting but prepend the main variables with statuses: instead of feed: as in the above example
{/statuses:data}
{/statuses}
{/exp:fb_link:graph}

Posts Only Example

This pulls only the posts by the page owner.

{exp:fb_link:graph request="your_page?fields=posts"}
{posts}
{posts:data}
your HTML formatting but prepend the main variables with posts:
{/posts:data}
{/posts}
{/exp:fb_link:graph}

Limiting data

By adding the limit parameter we can limit the number of items returned.

{exp:fb_link:graph request="your_page?fields=feed.limit(10)"}
{feed}
{feed:data}
your HTML formatting
{/feed:data}
{/feed}
{/exp:fb_link:graph}

Retrieving Specific Fields

By default all calls to the Graph return every available field for that connection. If you are only interested in certain fields then you can specify only returning those fields. For example if you only wanted to show a string of messages you could use the following code.

{exp:fb_link:graph request="your_page?fields=statuses.fields(message)"}
{statuses}
{statuses:data}
<div>{statuses:message}</div>
{/statuses:data}
{/statuses}
{/exp:fb_link:graph}

Retrieving the picture of the person who posted along with the feed

You can add specific nested items to the call as well. The one below will pull the picture of the individual who posted along with most of the feed data. You can add fields to it to get as much or as little as you want. For a list of available fields use the Facebook Graph Explorer to browse what is available.

{exp:fb_link:graph request="your_page?fields=feed.fields(id,from.fields(name,id,picture),story,message,type,created_time,comments,likes,link,name,picture"}

Got an example you'd like to see

If you need help figuring out a particular situation, then let me know. I'll be glad to add other examples or craft something specific for you.