Free Source Code – Twitter Display: twitter_display.php
Twitter Database Server
Twitter Display
Download
Install
Code Architecture
default.css
get_new_tweet_count.php
get_tweet_list.php
index.html
twitter_display.php
display_lib.php
site.js
tweet_list_template.txt
tweet_template.txt
twitter_display_config.php
This script is the way Web pages access the Twitter display plugin. It delivers fully formatted HTML with a list of recent tweets and supporting values for use by site.js after the page loads.
If you try running this script directly in a browser, you will see an unformatted set of HTML. To use this script, you need to create a Web page that also loads default.css, the jQuery library, and site.js. It is essential that the line loading jQuery comes before the line for site.js. index.html is an example of doing this correctly. Running this in a browser shows a formatted set of tweets with a Javascript-driven UI.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 | <?php /** * twitter_display.php * Deliver a complete set of tweets including the supporting HTML elements * Latest copy of this code: http://140dev.com/free-twitter-api-source-code-library/ * @author Adam Green <140dev@gmail.com> * @license GNU Public License * @version BETA 0.30 */ // Get constants for tweet display require_once("twitter_display_config.php"); // Get the HTML structure $tweet_page = file_get_contents('tweet_list_template.txt'); // Fill in the most recent individual tweets $tweet_page = str_replace( '[tweets]', require_once('get_tweet_list.php'), $tweet_page); // Fill in the constants and strings needed by site.js after the page loads $tweet_page = str_replace( '[new_count_refresh]', NEW_COUNT_REFRESH, $tweet_page); $tweet_page = str_replace( '[ajax_url]', AJAX_URL, $tweet_page); $tweet_page = str_replace( '[more_button]', MORE_BUTTON, $tweet_page); // Return the results as HTML print $tweet_page; ?> |
streaming_framework