Wednesday 25 May 2011

How To Display My Twitter Updates in Blogger


Do you want to show your recent tweets inside your website or blogger blog?Then,this tutorial will helpful for you, to add recent tweets into your website using Jquery.Your recent tweets will load fast using jquery and also you can change number of tweets must display very easily.If you want you can read advanced details about tutorial in next post.


Twitter is a social networking and microblogging service, owned and operated by Twitter Inc., that enables its users to send and read other user messages called tweets. Tweets are text-based posts of up to 140 characters displayed on the author's profile page.

Now follow the steps given below to add this recent tweets widget to your website or blog.

1.Login to your blogger dashboard--> Design - -> Edit HTML.

2.Scroll down to where you see </head> tag .

3.Copy below code and paste it just before the </head> tag .


<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js" type="text/javascript"></script>

<script type="text/javascript" charset="utf-8">

function showTweets(elem, username, number)
{
var html = '<ul>';


var tweetFeed = 'http://twitter.com/status/user_timeline/' + username + '.json?count=' + number + '&callback=?'
$.getJSON(tweetFeed, function(d)
{

$.each(d, function(i,item)
{
html+='<li>'+item.text+'</li>';
})
html+="</ul>";

elem.children().fadeOut('fast',function() {
elem.append(html);
})
})
}

$(function() {
$('#error').remove();
$('#preload').show();
showTweets($('#tweets'), 'btipandtrick', 5)
});

</script>

<style type="text/css">
#preload {display: none;}

#tweets ul li{
list-style-type:square;
list-style-position:inside;
list-style-image:url('https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjvrMnlMS2h-pay8NbcPbrZVT1hBKN6hsCSOmeovknrZm6OL49vKdCaKBUgGyyen8XhRo6xppx0BQD7C0AcNbkkYbkKA_Y4hoeEiRqWoTqiExPtUwBCuoqoAWdg8cgGUripFsAgZSxlXZw/s1600/twitter.png');
margin:0 0 0;
padding:0 0 0;
}
</style>

NOTE :
btipandtrick : Replace this with your twitter username.

5 : Number of tweets must appear.

4.Now save your template.

5.Go to Layout --> Page Elements.

6.Click on 'Add a Gadget'.

7.Select 'HTML/Javascript' and add the code given below:

<div style="font-size:12px;font-family:Arial;">
<div id="tweets">
<h3 id="error">There was a problem fetching tweets</h3>
<h3 id="preload">Currently loading your tweets...</h3>
</div>
<ul><li style="list-style-type:none;"><a href="http://www.twitter.com/btipandtrick">Follow me on twitter</a></li></ul>
</div>

You are done.

Please Dare T o Comment on my Post

7 comments:

  1. Dear Sir, Iam your last batch PHP student. Iam facing a problem in updating a particular row of the text file(student.txt) in php. I displayed the student.txt file in table in browser and I displayed the student name in anchor tag to select that particular row. Now how to get that row data to EDIT and UPDATE. How to do this using php coding? Dont use DB/phpmyadmin concept. Please kindly give the solution(code). Thankyou

    ReplyDelete
  2. In the above doubt the student names I displayed in anchor tag to select that particular row data. Please reply... Thankyou

    ReplyDelete
  3. hi sir i am one of u r old student i am interested to learn wordpress,mvc and zend how to learn is there any coaching centers please let me know or online websites,books,softcopy. Thank u.

    2. Sir, Plz help me sir. I downloaded the whole website using filezilla. i want to setup tht site in local system. how can i set it up in local. i want test and work on it on local

    ReplyDelete
  4. "Your template could not be parsed as it is not well-formed. Please make sure that all XML elements are closed properly.
    XML error message: The reference to entity "callback" must end with the ';' delimiter."

    I can the above message when I try to save the first code in my Edit HTML site. =(
    What did I do wrong? Can you help?

    ReplyDelete
  5. are you sure that you are pasting the code before closing tag of Head

    ReplyDelete
  6. In the end, keeping the classroom organized and on task, while teaching the required skills and concepts, and the whole time fostering an atmosphere of respect, humility, care and responsibility, describes the artistic process by which teachers conduct their lessons. The product of this artistic process is a class of pupils who respect and care for one another, during the process of effectively learning their subject matter.

    ReplyDelete