Jump to content


Photo

Latest twitter post


  • Please log in to reply
4 replies to this topic

#1 nygorn

nygorn

    Young Padawan

  • Members
  • Pip
  • 54 posts
  • Gender:Male
  • Location:Sweden

Posted 01 December 2010 - 03:05 PM

Hello.
I'm building a blog, and want to integrate "latest twitter post" in it.
Only problem is that every tutorial & script I find is in PHP (that works).
I've found a buch of JavaScript that doesn't work.

I'm hosting my blog on a swedish blog site that allows you to change the HTML files, but only save them in HTML.

So I need a script that will allow me to use it in HTML.

Anyone out there have an idea?

I know that Twitter has their own widget, but that doesn't allow me to ONLY get the text, name and time.
It makes me have their apparence on it that is locked to 250x500 with some background color and a bunch of images that I dont want

#2 Faken

Faken

    Pimpmaster G

  • Admin
  • 5,966 posts
  • Gender:Male
  • Location:Montreal, Canada

Posted 01 December 2010 - 03:29 PM

So the blog host doesn't allow you to use PHP of Javascript? Have you tried contacting the blog service provider to ask them for suggestions?

#3 Hayden

Hayden

    P2L Jedi

  • Members
  • PipPipPip
  • 717 posts
  • Gender:Male
  • Location:Texas

Posted 02 December 2010 - 01:27 AM

Twitter cut off basic authentication for getting status updates. You'd have to setup an application with an API and authenticate with your Twitter feed with OAuth.

http://dev.twitter.com/pages/auth


Another option is to use a JSONP request which does not require authentication. That's how I did it over at my site, http://fortytwo.me.

var tweetJSONP = new Request.JSONP({
		url: 'http://twitter.com/statuses/user_timeline/214119863.json',
		data: {
			count: '2'
		},
		onComplete: function(data){
			// the request was completed.
			var dl = new Element('dl');
			data.each(function(e){
				new Element('dd',{'html':e.text}).inject(dl);
			});
			$('twitter').adopt(dl);
		}.bind(this)
	}).send();

FYI, that's using Mootools, I don't care for JQuery all that much but it wouldn't be much different.

#4 nygorn

nygorn

    Young Padawan

  • Members
  • Pip
  • 54 posts
  • Gender:Male
  • Location:Sweden

Posted 03 December 2010 - 07:28 AM

The host creates a pre-made website, that i can edit in a editor there, in HTML files.
I can use everything as long it's working in an HTML file.

Sorry hayden, i've never used jQuery or Motools so I've no idea how that script works :P
Care to build a standalone for me?

#5 chewx

chewx

    Young Padawan

  • Members
  • Pip
  • 15 posts
  • Location:NOTTINGHAM, UK

Posted 04 December 2010 - 06:32 PM

<script src="http://twitterjs.googlecode.com/svn/trunk/src/twitter.min.js" type="text/javascript"></script>
<script type="text/javascript" charset="utf-8">
getTwitters('tweet', { 
  id: 'name of twitter here', 
  count: 1, 
  enableLinks: true, 
  ignoreReplies: true, 
  clearContents: true,
  template: '"%text%" <a href="http://twitter.com/%user_screen_name%/statuses/%id%/">%time%</a>'
});
</script>

Very simple jquery.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users