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

Free Source Code – Twitter Display: index.html

This is a simple example of using the Twitter display plugin. Index.html shows that the tweet list can be included within a page with a single line of PHP (line 22). This line should print the results of require('twitter_display.php'). When the page is run in a browser, twitter_display.php in this directory is run and returns the tweet list as HTML.

In addition to getting the tweet list HTML, you also need to load a CSS file that formats the tweets (line 7). If you want the tweet list to be interactive with a refreshing new tweet count at the top, and a button to load older tweets at the bottom, you need to load the jQuery library and site.js (lines 8-11). If you don’t include these two files, the tweet list will load and display correctly, but the list will be static with no interactivity.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" 
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" dir="ltr" lang="en-US">
<head>
<title>Demonstration of the 140dev Twitter display plugin</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<link rel="stylesheet" href="default.css" type="text/css" />
<script type="text/javascript" src="http://code.jquery.com/jquery-latest.min.js">
</script>
<script type="text/javascript" src="site.js">
</script>
</head>
<body>
 <h2>Demonstration of the 140dev Twitter display plugin</h2>
 
<?php require('twitter_display.php'); ?>

</body>
</html>

streaming_framework