Any chance the wonderful people here on daniweb could help me again with a loop? My apologies, loops are not my thing :| Basically what I'm trying to do is add a condition where on the last tweet (that is where the loop = $nooftweets), that tweet gets a different <span> class. Here's the function --

function get_tweets($twitter_id,
                    $nooftweets=3,
                    $dateFormat="m/d/y",
                    $includeReplies=false,
                    $dateTimeZone="America/New_York",
                    $beforeTweetsHtml="<ul>",
                    $tweetStartHtml="<li><p>",
                    $tweetMiddleHtml="&nbsp;&nbsp;<small>",
                    $tweetEndHtml="</small></p></li>",
                    $afterTweetsHtml="</ul>") {
 
    date_default_timezone_set($dateTimeZone);
    if ( $twitter_xml = twitter_status($twitter_id) ) {
        $result = $beforeTweetsHtml;
        foreach ($twitter_xml->status as $key => $status) {
            if ($includeReplies == true |
                    substr_count($status->text,"@") == 0 |
                    strpos($status->text,"@") != 0) {
                $message = processLinks($status->text);
                $result.=$tweetStartHtml.$message.$tweetMiddleHtml.
                            date($dateFormat,strtotime($status->created_at)).$tweetEndHtml;
                ++$i;
                if ($i == $nooftweets) break;
                }
            }
            $result.=$afterTweetsHtml;
    }
    else {
        $result.= $beforeTweetsHtml.
                    "<li id='tweet'>Twitter seems to be unavailable at the moment</li>".
                    $afterTweetsHtml;
    }
    echo $result;
}

Actually got it figured out, maybe I'm not as bad as loops as I thought... :scared:

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.