I rebuilt the code for the 104dev system using a WP-style architecture. As expected the messiest part was getting the directory paths right. I think the idea of putting most of the functionality into separate plugin directories will be a big win. There will be a very small core of tweet collection code and general purpose functions. If everything else is a plugin, others can build onto the system. Here is a very simple demo of the code in use.
The source of this page shows of easy it is to add Twitter functionality to any Web page:
<head>
<title>Tweet Display from Database Cache</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<link rel="stylesheet"
href="http://140dev.com/demo/themes/default.css" type="text/css" />
<script type="text/javascript"
src="http://ajax.googleapis.com/ajax/libs/jquery/1.4/jquery.min.js"></script>
<script type="text/javascript"
src="http://140dev.com/demo/plugins/tweet_display/site.js"></script>
</head>
<body>
<?php print file_get_contents('http://140dev.com/demo/plugins/tweet_display'); ?>
</body>
</html>
I’ll write up a tutorial to describe the architecture I used. The key is a decoupled approach. The 140dev server can deliver tweets to any site. That allows a single collection point for interaction with the Twitter API, but any number of display sites for the aggregated tweets.