TWITTER API 1.1. |
[eluser]Shella[/eluser]
Hi everybody, I'm getting frustrated with the new Twitter API 1.1. It's a week that I'm working on it and still I have not solved. Where I arrived is here throug this code by twitteroauth-master: Code: <?php So if I call the page it return correctly the tweet. The page is here: http://www.shella.it/get_tweet.php What I cannot do (because of my skill limits) is: 1) use a regex to transform a url in a link that work 2) use this code wherever I want because actually it's outside the logic MVC... I'd like to include it into a page but I can't. Could somebody help me? Would be great even for the community to give something cool and fresh for all the CI users. Cheers
[eluser]Ckirk[/eluser]
As luck would have it, I'm actually working on this right now for a client. I can't show you a working example as it's still in development & running on my local machine so I'll explain as best as i can and provide you with some of the files Solution: Use JavaScript AJAX method to call your codeigniter script. The codeigniter script returns a JSON list of tweets. The JavaScript uses the JSON data to write the html. Sources: TwitterFetcher - A spark plugin for codeigniter which I have modified to output JSON formatted tweets Twitfeed.js - Modify lines 6, 7 and 22 (twitter username and the ajax call to your codeigniter script) twitter.css - the stylesheet The code: HTML Code: <html> CI function Code: function ajax() I think that's enough to give you what you need
[eluser]Shella[/eluser]
Hey there, thanks to answer so quick. I will try your solution today and I will give a feedback. Thanks a lot for now. Have a beauuuutyfull day ;-) Shella
[eluser]Shella[/eluser]
Hey there, so I tried and I think I'm very close. Unfortunately I still can not see the tweets. You can see on www.shella.it (on the footer the second column). With a console tool or firebug i can see: Code: Uncaught TypeError: Property '$' of object [object Object] is not a function twitfeed.js:5 So I guess I have a Conflict with JS because I have another .js file that start with Code: jQuery.noConflict()(function($){ ... but I dunno how to manage it. Any ideas?
[eluser]Ckirk[/eluser]
That's probably the issue. You can define an alias for jquery for your twitter feed so that it doesn't conflict with your custom.js Try this solution Also I looked at the output from the ajax call. You still need to amend that library to output it in JSON format
[eluser]Shella[/eluser]
Hey! Sorry I start to be boring I know ;-) But I'm pretty close. I try the solution you suggested and yes... it works. Unfortunately I got an error in a pop up that say: Quote:parsererror - Unexpected token A Any idea what it is related to? Maybe is related to what you say: Quote:You still need to amend that library but I dunno what you mean :-s You can see the error appearing just going on my website www.shella.it Thanks a lot! |
Welcome Guest, Not a member yet? Register Sign In |