FamousWhy Editor:
mooTwits is a library that allows you to retrieve the latest tweets from twitter.
Using mooTwits is really simple, you just need mootools Core library. This file is included in the download, along with the mooCaption file.
MooTools is a compact, modular, Object-Oriented JavaScript framework designed for the intermediate to advanced JavaScript developer. It allows you to write powerful, flexible, and cross-browser code with its elegant, well documented, and coherent API.
You need to include the 2 files in betweend the
and of your html code. After you adjust the style sheet, you must add to your domready event, the call to mooTweets, like in the following example:
window.addEvent('domready', function(){
new mooTweets('tweets');});
These are the available properties and their default values:
- type: 'user'- It's the type of statuses timeline to fetch from twiter, it can be either user or public. Public will bring the 20 ltest tweets, no matter the count number;
- count: '5' - The amount of tweets to bring, defaults to 5.
- user: 'marceloOrigoni' - user the Twiter user, that you want to display the tweets, defaults to marceloOrigoni the producer of this software;
- tweetTwit: 'tweet' - The class for the container div of each tweet;
- tweetText: 'text' - The class for the text;
- tweetDate: 'date' - The class for the date div;
- tweetAuth: 'author' - The class for the author anchor;
- tweetLoad: 'loading' - The class that will be assigned to #container, while the tweets are beign loaded;
- tweetPHP: './tweets.php' - The location, relative to the webpage, of the tweets.php file, neeeded to get the JSON object;
- dateFormat: 'mm/dd/yyyy hh:ii' - defaults to mm/dd/yyyy hh:ii, you can move around the letters, and replaced the / for any symbol. No short year for the moment. Any other string, than mm, dd, yyyy. hh or ii, won't be replaced
- errorMessage: 'An Error Accoured While getting the latest Tweet' - In case something goes wrong, this error message will be displayed.
in Order to unserstand these 6 options, take a look at this code:
<#container>
<.twit>
<.text />
<.author />
<.date />
#container>
This is how mooTwits creates the twit element, and these options, set the classes, note the the #container, it's passed when you call mooTwits.
Why is mooTwits famous?
mooTwits is a great library that allows you to retrieve the latest tweets from twitter, created for the Twitter users.
Publisher: Marcelo Origoni
Tags: Twitter API, retrieve tweet,