level51 / silverstripe-fb-timeline-pics
A small SilverStripe module that accesses the timeline pictures (and posts) of a Facebook page.
Installs: 73
Dependents: 0
Suggesters: 0
Security: 0
Stars: 2
Watchers: 3
Forks: 2
Open Issues: 0
Type:silverstripe-module
Requires
- php: >=5.4
- facebook/php-sdk-v4: 5.0.*
Suggests
- colymba/gridfield-bulk-editing-tools: To allow bulk editing.
- undefinedoffset/sortablegridfield: To allow sorting of the video entries.
README
- Julian Scheuchenzuber js@lvl51.de
Installation
composer require level51/silverstripe-fb-timeline-pics
If you don't like composer you can just download and unpack it to fb-timeline/ under the root of your SilverStripe project.
Setup
- Obtain a valid app id and secret: https://developer.facebook.com/apps
- Provide your app credentials and Facebook page URL segment in the "Facebook" tab of the systems settings section.
- Go ahead and use it in your code (example snippets):
$pics = FacebookAPI::inst()->getPics(20); ... foreach(FacebookAPI::inst()->getPosts(6) as $post) { echo $post->Message . '<br>'; }
...or in the template:
<% loop $Pics(6) %>
$Tag<br>
<% end_loop %>
Notes
If you like to set up some continuous integration you can use the FacebookSyncTask
. Crontab in combination with the sake module could be a neat approach.
0 0 * * * cd /your/silverstripe/dir && sake dev/tasks/FacebookSyncTask > /dev/null 2>&1
Troubleshooting
- Make sure that new automatically generated folder facebook-pics/ (under the assets root) has full file access rights.