Jump to:

23002 Posts in 11855 Topics by 2828 members

General Questions

SilverStripe Forums » General Questions » [Solved] Twitter is non chronological

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

Page: 1
Go to End
Author Topic: 1323 Views
  • borriej
    Avatar
    Community Member
    267 Posts

    [Solved] Twitter is non chronological Link to this post

    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.

  • Ryan M.
    Avatar
    Community Member
    309 Posts

    Re: [Solved] Twitter is non chronological Link to this post

    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: http://doc.silverstripe.org/sapphire/en/reference/requirements

  • borriej
    Avatar
    Community Member
    267 Posts

    Re: [Solved] Twitter is non chronological Link to this post

    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

  • borriej
    Avatar
    Community Member
    267 Posts

    Re: [Solved] Twitter is non chronological Link to this post

    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!

  • biapar
    Avatar
    Forum Moderator
    435 Posts

    Re: [Solved] Twitter is non chronological Link to this post

    Which Module is? Is it go with 2.4.5?

  • borriej
    Avatar
    Community Member
    267 Posts

    Re: [Solved] Twitter is non chronological Link to this post

    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

  • edwardlewis
    Avatar
    Community Member
    32 Posts

    Re: [Solved] Twitter is non chronological Link to this post

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

    1323 Views
Page: 1
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.