Twitter Plugin
Posted by ajcates on Sun, 29 Mar 2009
In the last couple of months I have quietly been working on a Twitter plugin for Frog CMS. It comes complete with a system to cache updates.
Instructions:
Unzip and then place the contents in a folder named "twitter" in your /frog/plugins/ directory.
Put this code where you want to show your twitter updates. Replacing "Twitter_User_Name" with your twitter username. The second parameter is the number of updates you would like pull.
<? $tweets = twitterUpdates('Twitter_User_Name', 4); ?>
The $tweets variable will now hold an array of the tweet class. You can simply loop through the array just like any other.
<? foreach($tweets as $tweet): ?>
<li class="tweet"><?=$tweet->text;?><span><a href="<?=$tweet->date?>"><?=$tweet->date;?></a></span></li>
<? endforeach; ?>
The tweet object is mostly the same as the Status Element as described in the twitter documentation. I added 2 more items, url and date for convenience.
Next you need to set the twitter.xml file to be readable and writable to php. You can do this by using the chmod command:chmod a+r+w twitter.xml