1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

XF 1.5 Widgets and external data.

Discussion in 'Styling and Customization Questions' started by OldCoals, Aug 11, 2016.

  1. OldCoals

    OldCoals Active Member

    I would like to add a widget or the equivalent to the side bar that uses some json code.

    The code in question is a football team selector/player rating tool (not sure if i am allowed to link to the website).

    Is there a widget available that can do this?
  2. Brogan

    Brogan XenForo Moderator Staff Member

    If it's a standalone widget which is intended to be embedded on sites, you can add the code to one of the sidebar ad templates.
  3. OldCoals

    OldCoals Active Member

    Thanks for your reply.

    This is a sample of the code.

        <title>Your Website Title</title>
        <!-- Load jQuery -->
        <script src="//code.jquery.com/jquery-2.1.4.min.js"></script>
        <!-- Load Stats FC Player Rater SDK -->
            (function(d, s, id) {
                var js, fjs = d.getElementsByTagName(s)[0];
                if (d.getElementById(id)) return;
                js = d.createElement(s); js.id = id;
                js.src = '//api.statsfc.com/widget/player-rater-1.0.js';
                fjs.parentNode.insertBefore(js, fjs);
            }(document, 'script', 'statsfc-player-rater-js'));
        <!-- Your player rater here -->
        <div class="statsfc-player-rater"
            data-key="YOUR STATSFC KEY"
  4. Brogan

    Brogan XenForo Moderator Staff Member

    That should in theory be possible.

    You don't need the html, head, and body tags and don't include jquery as XF already includes it.

    So literally just use the code below <!-- Load Stats FC Player Rater SDK -->
  5. OldCoals

    OldCoals Active Member

    Brilliant, thanks very much.

    Which template would I need to edit please?
  6. Brogan

    Brogan XenForo Moderator Staff Member

    Probably ad_sidebar_below_visitor_panel.
    OldCoals likes this.
  7. OldCoals

    OldCoals Active Member

    Absolutely perfect, I didn't think it would be that easy. :D

Share This Page