I have created a smartphone app, for taking scores from a game I play with some friends.
The phone transmits these scores live to my umbraco web site, where they are stored in a database. This all works fine.
But what I would really like to do is create a widget that my friends can embed on their website, where they can display live scores. Preferably I would like this widget to be push updated, but a simple pull update could also be ok.
I have never created widgets like this before, and don't know the best approach to doing this, and all input is welcome!
The easiest thing may to just use iframe's (that is what google does with its calendar's). So, you would just create one page on your site where all it is is this live scores (no, header/navigation/etc). Then, you just give your friends the iframe for it. <iframe src="urlOfLiveScorePage" width="300px" height="300px" />. Then, on that page, you could auto-refresh and do whatever you wanted.
1. Create an xslt macro that outputs the live scores as json, or maybe even html (more verbose but less js work on the client).
2. Create an empty template and put the macro there.
3. Create a content node and apply this template.
The widget on the client web page:
Write a small js script that
1. Fetches the json data/html with jquery ajax.
2. If json data transforms into html.
3. Injects the html into selected container on the client page (div or similar).
Proper web services or web methods in .net could be another ways of doing it. I like the method I have outlined because it makes it possible to do it all without opening visual studio, and is easy to modify using just the umbraco ui.
Live Scores Widget
Hi Guys,
I have created a smartphone app, for taking scores from a game I play with some friends.
The phone transmits these scores live to my umbraco web site, where they are stored in a database. This all works fine.
But what I would really like to do is create a widget that my friends can embed on their website, where they can display live scores. Preferably I would like this widget to be push updated, but a simple pull update could also be ok.
I have never created widgets like this before, and don't know the best approach to doing this, and all input is welcome!
/RasB
The easiest thing may to just use iframe's (that is what google does with its calendar's). So, you would just create one page on your site where all it is is this live scores (no, header/navigation/etc). Then, you just give your friends the iframe for it. <iframe src="urlOfLiveScorePage" width="300px" height="300px" />. Then, on that page, you could auto-refresh and do whatever you wanted.
One way of doing it, without .net:
On your server server:
1. Create an xslt macro that outputs the live scores as json, or maybe even html (more verbose but less js work on the client).
2. Create an empty template and put the macro there.
3. Create a content node and apply this template.
The widget on the client web page:
Write a small js script that
1. Fetches the json data/html with jquery ajax.
2. If json data transforms into html.
3. Injects the html into selected container on the client page (div or similar).
Proper web services or web methods in .net could be another ways of doing it. I like the method I have outlined because it makes it possible to do it all without opening visual studio, and is easy to modify using just the umbraco ui.
Hi Daniel,
That looks like a good way of doing it. Do you have any pointers on where I should look for info on how to go about that?
I like this method as well, because it doesn't have to refresh the page constantly... at least as I understand it.
/RasB
is working on a reply...