This post is a continuation of my previous post. I will explain how to implement a job interview application I was given last year. Let’s call it Twitter accounts feed. In case you missed it here are our tasks:
- Build PHP script that will pull Twitter feeds for each selected account, merge them and sort by time of post and return as JSON.
- Implement sliding functionality for switching the panels on page (existing panel moves to the left, new one arrives from the right side replacing existing one).
Clearly this application can be done without the PHP part, but the purpose of this is to also test applicant’s PHP programing skills. As you may assume I already written this application and shared it on github. You can find source code here and demo here.
Basically it goes something like this:
First file handles the submit event of the main form. After submitting the form it pulls feeds from fetchfeeds.php script in JSON format and renders it as HTML panels. Also after html is generated the sliding effect is applied. fechfeeds.php script is using two classes TwitterFeed which represents the feed for the account and TwitterFeedCollection for representing collection of feeds.
For now you can just look at the source code and code comments on github but eventually I will write proper tutorial on specifics of each file.