It was cold and rainy last night, so rather than go for a ride, I made a few improvements to my RSS parser script that should make it more user-friendly.
First, I internationalized the script a bit. The script should now display all results in your preferred local units (assuming you have these set up on RS).
Second, I added the capability to input the target username via the calling URL. Thus, it is possible to use the script with multiple usernames without having to edit the script each time. Also, you won't need your own Google Maps API key if you call the script remotely from my machine.
You can download a copy of the revised script
here. Also, you can link directly to the script using this url:
http://dave.tycho.ws/st/actlist.php?targetuser=dra - just change the targetuser to your favorite username.
Third, I spent some time thinking about the best way to embed the activities list in a blog. The best way would be to use SSI, but that doesn't really work well due to W3C security policies if you don't want to host the script locally.
The second best (and most workable) way to do this is to embed the script url using an iframe. But even an iframe has some cross-browser compatibility and scrollbar issues. However, the careful use of some CSS and conditional comments can make it work reasonably well for most browsers.
I've put together a short html file that will call the php script and render the results in your browser. This file doesn't require php on your web server. To install it, copy the html below and save it in a text file named something like activitylist.htm in the filespace of your web server, and then point your browser to it. (in fact, if you just want to run it locally, it doesn't even require a web server. Just save the html as a text file and load it into your browser using the "Open File" command). Be sure to change the name of the targetuser in the file before saving - you need to do it on two different lines in the file, once for MS Internet Explorer and once for Mozilla-based browsers.
Here's the html code to call the script:
Code:
<html>
<head>
<title>RunSaturday Activities List</title>
<style type="text/css">
#iframe_good {
position:absolute;
top: 30px;
left: 0px;
right: 0px;
bottom: 0px;
</style>
</head>
<!--[if IE]><body scroll="no"><![endif]--><!--[if !IE]><!--><body><!--<![endif]-->
<div>
See my last 10 activites from <a href="http://www.runsaturday.com" target="_blank">RunSaturday.com</a>!<br />
</div>
<!--[if !IE]><!-->
<div id="iframe_good">
<iframe scrolling="auto" id="iframe" frameborder="0" src="http://dave.tycho.ws/st/actlist.php?targetuser=dra" width="100%" height="100%">
</iframe>
</div>
<!--<![endif]-->
<!--[if IE]><iframe id="iframe_bad" src="http://dave.tycho.ws/st/actlist.php?targetuser=dra" width="100%" height="100%" frameborder="0"><![endif]-->
</body>
</html>
If you want to embed an iframe containing my php script into your blog, don't just wrap the above html in another iframe. If you do, you will end up with the same old double scrollbar problem. Instead, use the html above as a guide to making an iframe with a single scrollbar.
Enjoy!
Dave