• ryebrye

    (@ryebrye)


    Anyone want to help me bang out a quick medal count plugin? I’ve been trying to find an XML feed of the medal count – but no such luck yet. Google has a medal count that shows up if you just type “olympics medal count” but that’s not on my blog ??

Viewing 11 replies - 1 through 11 (of 11 total)
  • hbalagh

    (@hbalagh)

    that would be interesting i would love to have something on my blog like this too

    Thread Starter ryebrye

    (@ryebrye)

    https://cbs.sportsline.com/olympics/box-scoreboards

    That’s the cleanest source of data I’ve seen so far – just a plain table.

    The NBC olympics one loads the data in arrays so that you can sort it by different categories.

    Ming

    (@ming)

    Yahoo! has RSS feeds for the medal count. Not sure how often the feed is updated.

    https://sports.yahoo.com/olympics/torino2006/medals

    Thread Starter ryebrye

    (@ryebrye)

    That RSS feed is probably a good source. It still doesn’t have the data in XML – the data is sent out in an HTML table. Not a bad start. I might play with this later today if I get time.

    What’s the best way to snag data in PHP? Does it have good support for regular expressions, or am I going to have to write a script to troll through and manually parse it out of the table?

    hbalagh

    (@hbalagh)

    i think it would also be cool for when the world cup comes to have a similiar plugin

    Thread Starter ryebrye

    (@ryebrye)

    I got something working using the CG FeedReader plugin, a little bit of CSS work – and that RSS feed you sent me.

    Here’s the way you do it… First download and install the CG-PowerBack:

    https://www.chait.net/index.php?p=238/

    (The latest version for 1.5.13 works fine for WordPress 2.0) – install those plugins with the instructions given

    In your sidebar.php – add the following: (Replace “Title you want” with whatever titling method you use inside your sidebar. I use <h2> tags…)


    <div id="medalcount"> Title you want
    <?php
    $feedUrl = "https://sports.yahoo.com/olympics/torino2006/medals/rss.xml";

    $feedOut = getSomeFeed($feedUrl, $maxItemsPerFeed=1, $showDetails=true, $cacheName="feed-medalcount", $filterCat='',$tLimit = -1, $dLimit = -1, $noHTML = false,
    $showTime = true, $feedStyle = 0, $noTitle = true, $showTimeGMT = false, $titleImages = false, $multiSiteTitle=false,$makeRSS=false, $rssName="CG-FeedRead Multifeed", $rssLink="https://www.chait.net/&quot;);

    if ($feedOut)
    echo $feedOut;
    ?>
    </div>

    In your CSS file, if you want to get rid of the titles so it blends in better, include these lines:

    .medalcount .feedDescription {
    display: none;
    }

    .medalcount .feedItemTitle {
    margin: 0.5em 0 0 0;
    padding:0.5em;
    font-size:0.9em;
    }

    .medalcount .feedItem tr.last {
    display: none;
    }
    .medalcount .meta {
    font-size: 0.9em;
    padding: 0.5em;
    }

    That will get rid of the “Powered by Chevy Tahoe” line – along with the other lines, but will still link to Yahoo for the main medal count page.

    This solution works for me, so I’m not interested in building a custom plugin just for the next two weeks. When the worldcup comes along, just pray that Yahoo has an RSS feed for that medalcount, and this would be very simple to implement for that too (provided they throw a nice HMTL table in their RSS feed again)

    I haven’t yet seen if the CG-FeedReader will automatically update the medalcount because I haven’t seen Yahoo update it yet. I will know tomorrow if it actually updates the feed. ??

    You can see it working in my sidebar here:
    https://www.ryebrye.com/blog/

    You may have to expand the menu for it if it isn’t expanded by default for you.

    Ryan

    Ming

    (@ming)

    Nice work, I like it. I hadn’t thought of checking medal counts through a RSS feed but now that you brought it up I’m surprised theres so little out there. It seems like a perfect use for syndication. Looks like you’re just way ahead of the crowd!

    corruptinc

    (@corruptinc)

    Great Idea I have implemented on my page but I think the feed has changed today and a Graphic bar has been added for the medals. Not sure how to get rid of it as it is too wide for my sidebar.

    Any help is appreciated

    tylerc

    (@tylerc)

    Thanks! I have it working at https://www.tylercranston.com

    Thread Starter ryebrye

    (@ryebrye)

    Sorry I didn’t monitor this thread better…

    To get rid of the graphic sidebar you need to make this change to the CSS… Unfortunately this means that the “G S B” text that used to be there is no longer – so the columns will have no identification.

    (It’s simple enough for the average viewer to be able to decipher though… or at least it’s easier to leave it headerless than it is to write some PHP to inject a header into it)

    .medalcount thead {
    display: none;
    }

    Edit: Another thing you will want to do when you implement this is make the CGFeedRead update your feed more often. This is done be editing the file:

    plugins/cg-plugins/cg-feedreed.php

    Edit line #50: Where it says
    $XML_CACHE_TIME = 6 * 60 * 60; // hr * min/h * secs/m -- you can change this for faster updates of the caches.

    (I think that was the default…)

    I changed mine to update every 10 minutes by using this code:

    $XML_CACHE_TIME = 1 * 10 * 60;

    If you ever want to manually reload the feed – simply delete the cache files in the cache_feedreed directory.

    corruptinc

    (@corruptinc)

    Thanks Appreciate it. This is terrific!

Viewing 11 replies - 1 through 11 (of 11 total)
  • The topic ‘Winter Olympics Medal Count plugin?’ is closed to new replies.