Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#13 2009-10-15 21:23:22

geoff777
Plugin Author
From: Benarrabá Andalucía Spain
Registered: 2008-02-19
Posts: 282
Website

Re: [request] twitter plugin?

I can’t get this plugin to work.

I’ve installed 1.3.2

php5
txp 4.0.8 live
curl – enabled libcurl/7.15.5 OpenSSL/0.9.8b zlib/1.2.3 libidn/0.6.5
fopen on

custom_1 changed to twitter

twitter info double & triple checked

It did work for a while 9months ago.
Any ideas?
I get no error messages.

Thanks


There are 10 types of people in the world: those who understand binary, and those who don’t.

Offline

#14 2011-12-08 07:35:41

bici
Member
From: vancouver
Registered: 2004-02-24
Posts: 2,092
Website Mastodon

Re: [request] twitter plugin?

Hi
This used to work in getting twitter feeds… but no longer:

<script type="text/javascript" src="http://twitter.com/javascripts/blogger.js"></script> <script text="text/javascript" src="http://twitter.com/statuses/user_timeline/bici.json?callback=twitterCallback2&count=2"></script>

anyone know what the proper code is now that we should use?


…. texted postive

Offline

#15 2011-12-08 17:44:54

MattD
Plugin Author
From: Monterey, California
Registered: 2008-03-21
Posts: 1,254
Website

Re: [request] twitter plugin?

bici wrote:

anyone know what the proper code is now that we should use?

Does this page on twitter.com help?


My Plugins

Piwik Dashboard, Google Analytics Dashboard, Minibar, Article Image Colorpicker, Admin Datepicker, Admin Google Map, Admin Colorpicker

Offline

#16 2011-12-08 19:11:13

joebaich
Member
From: DC Metro Area and elsewhere
Registered: 2006-09-24
Posts: 507
Website

Re: [request] twitter plugin?

Offline

#17 2011-12-08 19:12:35

Gocom
Developer Emeritus
From: Helsinki, Finland
Registered: 2006-07-14
Posts: 4,533
Website

Re: [request] twitter plugin?

bici wrote:

This used to work in getting twitter feeds… but no longer:

What is the issue? As I see, it works just fine for what it is. Just remember that currently Twitter requires HTTPS (change the protocol). Requests done via non-secure protocol will be force-redirected (which may cause problems you are having). As far as using the script you mentioned goes, it is as simple as:

<!doctype html>
<html lang="en">
<head>
</head>
<body>
	<ul id="twitter_update_list"></ul>
	<script type="text/javascript" src="https://twitter.com/javascripts/blogger.js"></script>
	<script text="text/javascript" src="https://twitter.com/statuses/user_timeline/bici.json?callback=twitterCallback2"></script>
</body>
</html>

The code validates and provides the Tweets the code is supposed select. As the scripts are initialized right away, remember to either place the snippets after the #twitter_update_list node, or load script on an event that takes place after the element is done.

But as said, it works fine for what it is. There are problems in fact. First of all the API you mentioned is deprecated, and might be gone the next day. Second issue is that it doesn’t support Twitter’s new (-er) native re-tweets, and probably neither some other features. So as you are showing only two tweets, you will get none if your two last tweets were native re-tweets (using the new retweet function, not the old tagging thing and such).

And the last issue is the fact that the script is rate limited. If your website is somewhat popular some of the visitors will not see any tweets. When any of the issues arise, the visitor will likely get bunch of JavaScript errors. On JavaScript heavy site this means the whole site breaks. Or takes several seconds to load untill the script timeouts.

If you want get over the rate limiting you will have to use the new APIs and… likely cache the results. To do so, you could use some of the Twitter plugins available. You could also use the feeds directly with any of the XML plugins (like smd_xml). Or you could use those widgets as Matt suggested. Other thing if you like them. Those widgets. They look nice, but do they fit every site.

Does that mean you can’t use the snippet you mentioned? No. Not really. Not for now at least. There is updated version available which supports Twitter’s newer updates. Implementing it is as easy:

<!doctype html>
<html lang="en">
<head>
</head>
<body>
	<ul id="twitter_update_list"></ul>
	<script type="text/javascript" src="https://twitter.com/javascripts/blogger.js"></script>
	<script text="text/javascript" src="https://api.twitter.com/1/statuses/user_timeline.json?screen_name=bici&amp;include_rts=true&amp;count=2&amp;callback=twitterCallback2"></script>
</body>
</html>

It’s just matter changing the API URL. It will also support re-tweets. Provides stable results. Should you use the newer methods, badges or other-than-this API? Maybe. The API documentation isn’t exactly clear, so I do not no if the newer URL is deprecated. Well, mostly is probably up to me failing at reading — and writing apparently. But well, the old URL is. Time to update, I suppose.

Last edited by Gocom (2011-12-08 19:18:05)

Offline

#18 2011-12-08 21:22:45

bici
Member
From: vancouver
Registered: 2004-02-24
Posts: 2,092
Website Mastodon

Re: [request] twitter plugin?

Jukka – Thank-you for your through and illuminating explanation! very much appreciated.

I now have the script working again. The issue was mainly to do with a Safari app called Ghostry that was blocking the scripts ;-)

But i did update the scripts to sue the latest Twitter api. and https

Plus I was able to add the correct scripts ion my friends website as well.

And the bonus is thatI have found your website with a slew of great plugins! a treasure trove!!

May the “Force of Textpattern” be with you


…. texted postive

Offline

Board footer

Powered by FluxBB