forked from remi/pubwich
-
Notifications
You must be signed in to change notification settings - Fork 27
ServiceFacebook
Michael Haschke edited this page Jul 12, 2015
·
1 revision
This service integrates public posts from Facebook pages within your PubwichFork page.
Before you can use the Facebook service class you need to create a new Facebook application because the service class needs a valid access token to request data. It's easy to create it:
- Go to https://developers.facebook.com/apps/ and create a new application
- Fill out the data:
- Platform: Website
- Name: My PubwichFork
- Website: http://example.com/pubwichfork (use the URL where your PubwichFork installation is accessible)
- Save it
- Get id and secret from the app dashboard
Copy application id and application secret to configure the Facebook service class.
-
method:
FacebookPage
is provided and supported for now -
pagename: the page name from the URL, as in
https://www.facebook.com/pagename
-
pageid: the id as in
https://www.facebook.com/pages/Name-of-Page/pageid
is only necessary if the page name is not available - app_id: the id of the application that you have created for your PubwichFork instance
- *app_secret: the secret key of the application
... and all basic options of services.
$facebook_page = array(
'Facebook', 'facebook_page', array(
'method' => 'FacebookPage',
'pagename' => 'angstbreaker',
'app_id' => 'YOUR_APP_ID_NUMBER',
'app_secret' => 'YOUR_APP_SECRET_STRING',
'total' => 5,
'title' => 'Facebook',
'description' => 'Angstbreaker news'
)
);
- message: the original message text if there is any
- status: the text with links for @username, #hashtag, URL strings; and replacements for known URLs and shared Links
- date: date of the post
- link: permanent URL of the post
- media_thumbnail_url: URL of thumbnail for the post if there is any
- media_picture_url: URL of a full picture for the post if there is any
- type: type of the Facebook post, e.g. link, photo, video, ...
<li class="facebook-{{{type}}}">
{{#media_thumbnail_url}}
<img src="{{{media_thumbnail_url}}}" class="item-media-thumbnail" alt="" height="75" />
{{/media_thumbnail_url}}
{{{status}}}
(<a href="{{{link}}}">{{{date}}}</a>)
</li>