Skip to content

crep4ever/plx-fb-gallery

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Description

This repo is a proof of concept to convert a Facebook album gallery into PluXml articles.

  • fetch data from a public Facebook page through the graph api
  • process data into PluXml article structure
  • save articles into PluXml data/articles directory
  • keep track of processed articles

All the content of the demo website is automatically generated from this Facebook public page.

Overview

Files

  • class.fb.gallery.php: convert Facebook json data into PluXml's article format.

Note that you need a valid access token. For example, log in your Facebook account and visit the graph api explorer tool page to use your token.

<?php
$access_token = "00000000000000"; // your facebook access token
$page_id      = "00000000000000"; // your facebook page id
$graph_api    = "v2.7";
$gallery = new FacebookGallery($page_id, $access_token, $graph_api);
?>
  • class.fb.article.php: wrapper for PluXml's article format.

This class is used by FacebookGallery::toArticles() method. Building an article from facebook json data would look something like this:

<?php
$article = new Article();

// header
$article->setTitle($album['name']);
$article->setDate($album['created_time']);
$article->setDescription($album['description']);
$article->setPhotoCount($album['photo_count']);

// content
$article->startGallery();
$photos = $album['photos']['data'];
foreach ($photos as $photo)
{
  $article->addImage($photo['name'], $photo['source'], '');
}
$article->endGallery();
?>
  • index.php: write Facebook albums as PluXml articles.

PluXml configuration

About

Convert a Facebook album gallery into PluXml articles

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published