Adam Green
Twitter API Consultant
adam@140dev.com
781-879-2960
@140dev

Free Source Code – Twitter Display: Install

streaming_framework

Install the Twitter database server first

This plugin displays tweets collected by the 140dev Twitter database server. Before you can use this plugin you must install the 140dev Twitter database server, which includes the entire directory structure for the 140dev framework.

Upload the plugin files

Once the database server is installed and running, all you have to do to install the plugin is:

  • Download the Twitter display plugin zip file, and extract the /twitter_display directory.
  • Upload this directory to your Web server, placing it in the /plugins directory.
  • If you want to use the AJAX portion of this code, you must set the value of the AJAX_URL constant in /plugins/twitter_display/twitter_display_config.php.
  • You can test the installation of this plugin by viewing the sample index.html file in this directory. For example, if the 140dev Twitter framework is installed in http://yoursite.com/140dev, you would load http://yoursite.com/140dev/plugins/twitter_display/index.html in your browser.

What could go wrong?

If you don’t see a set of tweets in this page, there are number of things you can do to find the problem:

  • Is the database running and collecting tweets? Open the database you used to store the tweets from the Twitter database server, and check the tweets table. You can go to the last row and look at the created_at column to see if tweets are still being collected. If not, the problem may be in get_tweets.php or parse_tweets.php. The log file /db/error_log.txt may have informative error messages.
  • If the More Tweets button at the bottom of the tweet list isn’t working, check the AJAX_URL constant in /plugins/twitter_display/twitter_display_config.php.

Customizing the display

The display constants in twitter_display_config.php are already set, but you might want to change these to fit your needs. One cause for changing these constants would be switching from English to another language.

The other way to change the appearance of the tweets is by modifying the two text templates, tweet_template.txt and tweet_list_template.txt, or default.css.

Adding the Twitter display to your own pages

You can see from index.html how easy it is to display tweets in any Web page. All you have to do is load default.css, jQuery, and site.js in the head section of the HTML. Then you can place <?php print require('twitter_display.php'); ?> where you want the tweet list to appear in the page.

If you only need a static list of tweets that doesn’t have a More Tweets button or an updating count of new tweets, don’t load jQuery and site.js into your page. The tweet list will still be added to the initial load of the page.

Reporting any problems

If you have any problems with this code that you can’t solve, you can report it on the 140dev Google group, or contact Adam Green directly at 781-879-2960.