Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

General Questions /

General questions about getting started with SilverStripe that don't fit in any of the categories above.

Moderators: martimiz, Sean, biapar, Willr, Ingo, swaiba, simon_w

[Solved] Twitter is non chronological


Reply


7 Posts   1410 Views

Avatar
borriej

Community Member, 267 Posts

20 February 2011 at 3:22am

Edited: 20/02/2011 3:33am

When integrating the default twitter script on my page.ss

      <script src="http://widgets.twimg.com/j/2/widget.js"></script>
                     <script>
                     new TWTR.Widget({
                      version: 2,
                      type: 'profile',
                      rpp: 5,
                      interval: 6000,
                      width: 200,
                      height: 300,
                      theme: {
                        shell: {
                         background: '#FFF',
                         color: '#666666'
                        },
                        tweets: {
                         background: '#FFFFFF',
                         color: '#666',
                         links: '#53A318'
                        }
                      },
                      features: {
                        scrollbar: false,
                        loop: false,
                        live: false,
                        hashtags: true,
                        timestamp: true,
                        avatars: false,
                        behavior: 'all',
                      }
                     }).render().setUser('mynamehere').start();
                     </script>                     

I get them on my site, but the order is in reverse! The oldest is on top, and the most recent at the bottom.
How do i fix this?

Does this have to do with SilverStripe templates? Because on the twitter website (where you generate the code) it does seem to work normal?

And when i test the script as a html file, it is in the right order: Recent on top, oldest at the bottom.

Avatar
Ryan M.

Community Member, 309 Posts

20 February 2011 at 8:12am

I use the twitter widget too and haven't had that problem.

You might want to integrate the javascript by a different method instead -use the <% require javascript %> tag and Requirements::customScript.

See: [url]http://doc.silverstripe.org/sapphire/en/reference/requirements[/url]

Avatar
borriej

Community Member, 267 Posts

20 February 2011 at 9:43am

Ryan, thx for your reply.

I've modified my template:

in the headtags:

<% require javascript(http://widgets.twimg.com/j/2/widget.js) %>      

in the body:

<script>
new TWTR.Widget({
version: 2,
type: 'profile',
rpp: 5,
interval: 6000,
width: 200,
height: 300,
theme: {
   shell: {
    background: '#FFF',
    color: '#666666'
   },
   tweets: {
    background: '#FFFFFF',
    color: '#666',
    links: '#53A318'
   }
},
features: {
   scrollbar: false,
   loop: false,
   live: false,
   hashtags: true,
   timestamp: true,
   avatars: false,
   behavior: 'all',
}
}).render().setUser('name').start();
</script>

But still not in the right order.

Could you paste your code?

Im using SS 2.4.5 btw

Avatar
borriej

Community Member, 267 Posts

22 February 2011 at 6:59am

Thanks to UncleCheese!

add this to your controller:

class TemplateName_Controller extends Page_Controller {
   

public function init() {
parent::init();
Requirements::block('sapphire/thirdparty/prototype/prototype.js');
}
   
   
}

WORKS! :D

Avatar
biapar

Forum Moderator, 435 Posts

28 February 2011 at 7:00am

Which Module is? Is it go with 2.4.5?

Avatar
borriej

Community Member, 267 Posts

1 March 2011 at 10:34am

i think it works for the twitter module aswell. I am using the standard script provided by the twitter website.
Runs well on SS 2.4.5

Avatar
edwardlewis

Community Member, 32 Posts

6 September 2011 at 11:16am

Lol.. I just had that on a site. blocking prototype sorted it.