My favorites | Sign in
Project Logo
             
Search
for
Updated Oct 29, 2008 by ashleymg
Labels: Featured, Phase-Deploy
Installation  
General installation and setup instructions

Tweetments works well on a singular page, say a project page, or your home page, you could use it as a site-wide commenting system, but that's outside the scope of these instructions.

You will need a twitter account for use with this script, either you current one (useful for your home page), or one created just for this script (useful for a project page).

Be weary that credentials will be broadcast over clear text. If this makes you uncomfortable, let us remind you that Twitter allows you to login with and without a secure server.

Startup

These snippets are altered slightly from the demo files included with the release. The demo files rely upon a single tweetments call server from an independent file, it's your choice as to how you wish to work with tweetments.

You first must include the tweetments library in the page/file you wish to have comments displayed on.

include("./tweetments/tweetments.lib.inc");

Then you must initialize a connection, along with providing some credentials.

$tweetments = new Tweetments("username", "password");

Options

Tweetments makes some guesses about your environment, and sets options accordingly:

  1. New posts should be displayed at the top.
  2. Cache files should be considered "fresh" for five minutes.
  3. Cache files should live in the same directory as the file calling them.

To change these, you should use the various option methods we have provided:

Remember, the new location is relative to the file calling tweetments (the file with the initial include declaration).

$tweetments->setFileLocation("messages", "../messages.xml");

Set a new cache time in seconds, please be reasonable (Twitter doesn't like calls more frequently then about once a minute).

$tweetments->setcacheTime(120);

Anything other then "bottom" will display them at the top.

$tweetments->setNewAt("bottom");

General Use

Then you can call our various methods to gather your data, your replies, or people involved in the current conversations.

If you with to display your posts:

print_r($tweetments->justMe());

Your posts, with replies (useful for an application):

print_r($tweetments->withReplies());

Everyone involved in the current conversations (selected from the various cache files for this Tweetments environment):

print_r($tweetments->twits());

Sign in to add a comment
Hosted by Google Code