So I've purchased a Twitter feed PHP plugin online and have been able to successfully integrate it into my PHP code. Problem is the code itself is executing and printing at the top of my page (probably due to the echoes). Here is the code that is executing from the include file:
public function PrintFeed($callback = null) {
if(!self::isLoaded())
self::loadRequest();
$iterator = self::getRequestDataIterator();
// we can't iterate this feed
if(!isset($iterator) || !is_array($iterator))
throw new TwitterException(self::$ERROR_PRINT_FEED_UNSUPPORTED_REQUEST, self::option('request_type'));
$callable = is_callable($callback);
echo self::option('html_before');
$total = array();
$max = self::option('count') ?: $this->defaultCount;
foreach($iterator as $i => $tweet) {
if(empty($tweet))
continue;
if(self::option('count_mode') == self::CountPerObject) {
$user = $tweet[$tweet['is_retweet'] ? 'retweeter' : 'user']['screen_name'];
if(!isset($total[$user]))
$total[$user] = 1;
else
$total[$user]++;
if($total[$user] > $max)
continue;
} else if($i + 1 > $max) {
break;
}
if($callable)
call_user_func($callback, $tweet);
else
echo self::formatString(self::option($tweet['is_retweet'] ? 'format_retweet' : 'format'), $tweet, 'tweet');
}
echo self::option('html_after');
}
To display the feed on my page, I am using the following:
$twitter->PrintFeed('twitterStyle');
Question is how do I get this feed to display inline (ie. following other content on my site)?
Aucun commentaire:
Enregistrer un commentaire