Loading twitter status...

Mephisto Plugin for Twitter

dnite / 22.Mar.2007

I’m late to the bus. I just found twitter yesterday and I think it’s a pretty cool concept. It’s nothing entirely useful, but it’s just fun. Don’t get me wrong, I’ve HEARD of twitter, just never tried it out until yesterday. Also, yesterday, I started screwing around with Dan Webb’s mephisto plugin for lastfm. What do these 2 things have in common you might be wondering? After looking at how easy it was to grab an xml file with users timelines from twitter via their api, I realized how easy it would be to modify Dan’s excellent lastfm plugin to work with twitter. So that’s what I did. I created a quick edit of the lastfm mephisto plugin to create my very own twitter mephisto plugin!

It seems to work pretty well. I’m actually intending on making it a little more feature packed in the future. There’s not a whole lot more you can do with it considering Twitter’s super duper simplicity, but I might take a stab at adding basic authentication so you can view ALL of your timelines with this plugin or maybe even come up with some way that you can edit create new status messages from your blog or your blogs admin page (when mephisto matures a little more to support admin plugins). Anyways, enough blabbing by me. Here’s the 411 on how to use it.

Install it like so from your mephisto root.
script/plugin install http://svn.dnite.org/mephisto_twitter

Restart your mephisto (I’m pretty sure this is necisary to load up the new plugin) and you can edit your layout page (or any of your liquid pages) to include your twitter status!

{% twittertimeline user: 'swemoney', type: 'user_timeline' as status %}
  {{ status.text }} - {{ status.relative_created_at }}
{% endtwittertimeline %}

If you want to know where your at in the loop, twittertimeline.index will return that for you. Any questions, post them here!

4 Comments

Hello,

Thanks for your plugin but I’ve a problem. I want to show one post and I write this: {% twittertimeline user: 'my_username', type: 'user_timeline', top: 1 as status %} But it doesn’t work, it return
Something went wrong.

Thanks for your help.

I was having the same problem as justways—I couldn’t limit the number of twitter posts displayed. Using “top: 1” as in {% twittertimeline user: 'my_username', type: 'user_timeline', top: 1 as status %} wasn’t working, but I fixed it.

The problem is on line 23 of mephisto_twitter/lib/twitter_status.rb—it says: timeline = chart[0..options[:top].to_i - 1] if options[:top] but if you change it to: timeline = timeline[0..options[:top].to_i - 1] if options[:top] the twittertimeline tag above should work.

I think this has to do with adapting this plugin from Dan Webb’s lastfm plugin, he uses chart<code> as the variable while you use <code>timeline</code>. I hope this helps!

Heh, sorry about the html formatting error towards the end. It should look like:

I think this has to do with adapting this plugin from Dan Webb’s lastfm plugin, he uses chart as the variable while you use timeline. I hope this helps!

Hi, I just installed your plugin on my Mephisto 0.7.3 and experienced the problem: “Wrong num of argument (2 for 3)”. After some ressearch, I discovered the initialized method takes only 2 args. It seems this method has changed with new versions of Liquid plugin.

So in ‘twitter_status.rb’, the initialize method is declared like this: def initialize(markup, tokens)

Leave a Comment

back to top

micro theme by seaofclouds, edited by me, and powered with Mephisto