Need help on this one guys.. How can I show the Tweets texts not the JS/script in the HTML source of the page? Can't find any widget that is doing this. Reason for this is to have a SEO friendly page.. Thanks much!
Use Joomla for your web site. It comes with the ability to load and also share RSS feeds. Joomla is SEO friendly when set up correctly. You do not need to know code to use Joomla.
You will need to parse the RSS feed. Here is a quick and dirty method I tossed together last week: <?php /* GET TWITTER DATA INTO HTML */ $username = "[TWITTER-USER-NAME]"; //ENTER THE TWITTER ACCOUNT NAME HERE $limit = 3; //ENTER THE NUMBER OF TWEETS TO GET $feed = 'http://twitter.com/statuses/user_timeline.rss?screen_name='.$username.'&count='.$limit; $tweets_data = simplexml_load_file(urlencode($feed),'SimpleXMLElement', LIBXML_NOCDATA); $return_count = count($tweets_data->channel->item); $tweet_feed = ""; $tw_idx = 0; while ($tw_idx < $return_count) { $content = $tweets_data->channel->item[$tw_idx]->description; $content = preg_replace("/(http:\/\/|(www\.))(([^\s<]{4,68})[^\s<]*)/", '<a href="http://$2$3" target="_blank">$1$2$4</a>', $content); $content = str_replace("$username: ", "", $content); $content = preg_replace("/@(\w+)/", "<a href=\"http://www.twitter.com/\\1\" target=\"_blank\">@\\1</a>", $content); $content = preg_replace("/#(\w+)/", "<a href=\"http://search.twitter.com/search?q=\\1\" target=\"_blank\">#\\1</a>", $content); $posted_raw = strtotime($tweets_data->channel->item[$tw_idx]->pubDate); $now = strtotime("now"); $days_old_count = round(abs($now-$posted_raw)/60/60/24); switch ($days_old_count) { case 0: $days_old = "today"; break; case 1: $days_old = "yesterday"; break; default: $days_old = "$days_old_count days ago"; } $twitter_id = str_replace('http://twitter.com/' . $username . '/statuses/','',$tweets_data->channel->item[$tw_idx]->guid); $twitter_intent = (' <a href="https://twitter.com/intent/tweet?in_reply_to=' . $twitter_id . '">Reply</a> | <a href="https://twitter.com/intent/retweet?tweet_id=' . $twitter_id . '">Retweet</a> | <a href="https://twitter.com/intent/favorite?tweet_id=' . $twitter_id . '">Mark as Favorite</a> '); $idx_content = $content . "<br><small><b>Posted " . $days_old . ". $twitter_intent</b> </small>"; $tweet_feed .= "$idx_content<br><br>"; ++$tw_idx; } $tweets = "$tweet_feed"; /* DONE WITH THE PARSING STUFF, CREATE THE HTML WIDGET */ $html_fragment = ('<script type="text/javascript" src="http://platform.twitter.com/widgets.js"></script> <h2 id="accountsummary" >Recent <a href="http://www.twitter.com/' . $username . '">Tweets</a></h2> <iframe allowtransparency="true" frameborder="0" scrolling="no" src="http://platform.twitter.com/widgets/follow_button.html?screen_name=' . $username . '&show_count=false" style="width:200px; height:20px;"></iframe> <br> ' . $tweets ); ?> <?php /* ECHO THE HTML FRAGMENT - WRAP INTO YOUR OWN DIV*/ echo $html_fragment; ?> PHP: This will give you an HTML code fragment, echo'd in the example above, that you can use as needed. You can see this in action on our home page. Hope that gets you in the right direction. -Bing