PDA

View Full Version : Using variables from a separate file


estevesbk
06-03-2008, 10:30 PM
Hello guys! Let me explain the problem...

I have a website full of radios, 12 on total, and all of them have something like this:

<object id="Radio01"
classid="clsid:22D6F312-B0F6-11D0-94AB-0080C74C7E95"
type="application/x-oleobject"
width="140" height="45" align="middle">
<param name="FileName" value="Link_to_the_stream">
<param name="Autostart" value="False">
<param name="enableContextMenu" value="False">
<param name="ShowControls" value="True">
<param name="ShowDisplay" value="False">
<param name="ShowStatusBar" value="False">
<param name="Volume" value="100">
<embed
src="Link_to_the_stream"
type="application/x-mplayer2" pluginspage="http://www.microsoft.com/Windows/MediaPlayer/download/default.asp"
width="140" height="45" align="middle"
autostart="0"
enableContextMenu="0"
showcontrols="1"
showdisplay="0"
showstatusbar="0"
volume="100"></embed></object><br>
<b><a href="Link_to_the_website" target="_blank">
Radio_name
</a>

As the radios are continually going on and off, sometimes I need to switch them. But the html of my website is too long and I would not like to edit it every time I need to switch a radio. I would like to, instead, create an apart document with variables like:

Link_to_stream = "http://www.link.com:port/"
Link_to_the_website = "http://www.radiowebsite.com/"
Radio_name = "Name of the radio"

And then make the html call these variables, so if I wish to switch a radio, I would only edit the file... The tricky part would be to edit the object src, I think.

Is there any way to do that? Any method? I'm using conventional html on my website.

Thanks in advance! :)

JoeyDaly
06-03-2008, 11:24 PM
You can use javascript to embed your objects dynamically, something like this:

function showPlayer(var1,var2) {
var streamLink = var1;
var websiteLink = var2;
var renderHTML = "<embed><object></object></embed>";
document.getElementById('myPlayer').innerHTML = renderHTML;
}

estevesbk
06-03-2008, 11:37 PM
Hello Joey! Sorry, I don't understand what you mean... could you or someone be more specific? How do I tell the <param name="FileName" value="xxxxxxx"> to refer to one of the vars?

Thanks! :)