• 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.

OldCoals

Active member
#1
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?
 

Brogan

XenForo moderator
Staff member
#2
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.
 

OldCoals

Active member
#3
Thanks for your reply.

This is a sample of the code.


Code:
<html>
<head>
    <title>Your Website Title</title>
</head>
<body>

    <!-- Load jQuery -->
    <script src="//code.jquery.com/jquery-2.1.4.min.js"></script>

    <!-- Load Stats FC Player Rater SDK -->
    <script>
        (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'));
    </script>

    <!-- Your player rater here -->
    <div class="statsfc-player-rater"
        data-key="YOUR STATSFC KEY"
        data-team="Liverpool"
        data-use-default-css="true">
    </div>

</body>
</html>
 

Brogan

XenForo moderator
Staff member
#4
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 -->