dev-master
9999999-devAllows you to display an aggregated feed of posts originated from various social media sites.
BSD-3-Clause
The Requires
by david-ny
social feed facebook silverstripe instagram twitter youtube
Allows you to display an aggregated feed of posts originated from various social media sites.
This module allows you to display an aggregated feed of posts originated from various social media sites., (*1)
My intention was to make it easier to adapt the module to other frameworks. The core functionality is not relying on Silverstripe., (*2)
, (*3)
, (*4)
, (*5)
(You have to be logged in as administrator.), (*6)
, (*7)
composer require "devcreative/socialfeed"
edit the config file: Socialfeed.yaml
(Multiple feeds of the same type can be added.), (*8)
create a new SocialFeedPage., (*9)
//news source class News extends DataObject { private static $db = array( ,"Date" => "Date" ,"Title" => "Varchar(255)" ,"Content" => "HTMLText" ); public function date() { return $this->Date; } //... } class SocialFeedPage_Controller extends Page_Controller { //... public function getPosts() { //get news and posts $allNews = News::get(); $allPosts = $this->feeds->getAllPosts(); //merge into one array foreach ($allNews as $news) { array_push($allPosts, $news); } //sort by date usort($allPosts, function($a, $b) { return ($a->date() < $b->date())?true:false; }); //create ArrayList for template $list = ArrayList::create(array()); //add the sorted news and posts foreach ($allPosts as $post) { $list->push( (get_class($post) == "News")?$post:ArrayData::create($post->data()) ); } return new ArrayData(array("Posts" => $list)); } //... } //templates may need to be modified to display news
Allows you to display an aggregated feed of posts originated from various social media sites.
BSD-3-Clause
social feed facebook silverstripe instagram twitter youtube