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

Free Source Code – Twitter Display: tweet_list_template.txt

This template is used by index.php to define the structure of the entire list of tweets. It also has hidden divs that are filled in by twitter_display.php as a way of passing control values to site.js once the page is loaded.

The new tweet count at the top of the tweet list (line 2) starts off as hidden, and is filled in and made visible by site.js after it retrieves a count of new tweets from the server. The new count refresh value (line 3) tells site.js how many seconds to wait between requests for a new tweet count from the server. The setting for this is found in twitter_display_config.php.

The View More button at the bottom of the tweet list (lines 7-9) is filled in with the current number of tweets and made visible by site.js when the page first loads, and after the button is clicked to load more tweets.

Site.js makes its server requests to absolute URLs, so it needs to know where the server is located. It finds that value in the ajax_url div (line 11), which must be entered into twitter_display_config.php during installation.

1
2
3
4
5
6
7
8
9
10
11
12
13
<div id="tweet_column">
  <div id="ajax_url" class="hidden">[ajax_url]</div>
  <div id="new_tweet_count" class="hidden"></div>  
  <div id="new_count_refresh" class="hidden">[new_count_refresh]</div>  
  <div id="tweet_list"> 
    [tweets]
  </div>
  <div id="more_tweets_button" class="hidden">
    <span id="tweet_count"></span> [more_button]
  </div>
</div>

 

streaming_framework