Embedding the SLRadio widget in your website
Requirements
- The SLRadio archive (a XAP File), you can download here;
Steps
- Paste the code below in the section of your webpage, where you want the widget to appear:
<object bgcolor="323d46" id="SLR" data="data:application/x-silverlight-2," type="application/x-silverlight-2" width="330" height="430">
<param name="source" value="ClientBin/TenK.xap"/>
<param name="onerror" value="onSilverlightError" />
<param name="background" value="#d9ecec" />
<param name="windowsless" value="true" />
<param name="minRuntimeVersion" value="2.0.31005.0" />
<param name="autoUpgrade" value="true" />
<a href="http://go.microsoft.com/fwlink/?LinkID=124807" style="text-decoration: none;">
<img src="http://go.microsoft.com/fwlink/?LinkId=108181" alt="Get Microsoft Silverlight" style="border-style: none"/>
</a>
</object>We recommend to put this code in a div section, which will be easily stylable through CSS.
<script type="”text/javascript”">
function SLRADIO_initialize()
{
var control = document.getElementById(”SLR”);
control.content.SLRadio.setPresetsFile(”http://slradio.lookouster.org/res/presets.xml”);
control.content.SLRadio.setTemplate(2);
}
</script>
Let’s explain a bit what it is about.
var control = document.getElementById(”SLR”): This returns a reference to the object we described below.
control.content.SLRadio.setPresetsFile(”http://slradio.lookouster.org/presets.xml”): For customization purpose, SLRadio has some methods accessible for javascript callers. A full description of these methods can be found here. In this particular case, we’re calling the setPresetsFile method, which will tell the widget where to retrieve the webradios information from.
Omitting to call this method will result to a use of our default presets file you can download here.
control.content.SLRadio.setTemplate(2): Another call to one of the scriptable method SLRadio widget support. This one will enable you choosing a template for the widget.
You’re then done with the widget integration. Open your webpage in a browser, and abracadabra!!
