|
|
Joined: Oct 2002
Posts: 394
Enthusiast
|
Enthusiast
Joined: Oct 2002
Posts: 394 |
I have this code in my Header <embed height="1" src="http://www.romanianational.com/ubb/christmas/carols/cvpastori.mid" width="1" EN? 3.2 HTML DTD W3C ?- PUBLIC <!DOCTYPE AUTOSTART="TRUE"> which plays a Christmas song on the page. Is there a way to make the .mid file change automatically every day without editing the Style Header daily? Felix
|
|
|
|
Joined: Jan 2003
Posts: 3,456 Likes: 2
Master Hacker
|
Master Hacker
Joined: Jan 2003
Posts: 3,456 Likes: 2 |
um, upload a different song to that url everyday? and about the html, how about something like <embed src="http://www.romanianational.com/ubb/christmas/carols/cvpastori.mid" style="display: none;" autostart="true"></embed> I doubt it's the right syntax, but it's probably a lot closer than what you have
|
|
|
|
Joined: Oct 2002
Posts: 394
Enthusiast
|
Enthusiast
Joined: Oct 2002
Posts: 394 |
Yes, your code is much cleaner. Mine was generated by the FrontPage and didnt bother to clean it, why fix it if it works? As far as "upload a different song every day"....I know I have been doing that all along, I was thinking I could set it up to change it by itself.. Thank you, Felix
|
|
|
|
Joined: Jun 2001
Posts: 729
Coder
|
Coder
Joined: Jun 2001
Posts: 729 |
Try this... <SCRIPT LANGUAGE="Javascript"><!-- function sound() { //Random Sounds } ; s = new sound() ; n = 0
// - Sound Database - s[n++]= "Some.wav" s[n++]= "OrSome.mid" s[n++]= "Another.wav" s[n++]= "Again.mid" s[n++]= "And.wav" s[n++]= "sound.mid"
i=Math.floor(Math.random() * n) ;
if (navigator.appName.indexOf("Microsoft") != -1){ document.write('<BGSOUND SRC="'+ s[i] +'"> ') } else if (navigator.appName.indexOf("Netscape") != -1){ document.write('<EMBED SRC="'+ s[i] +'" HIDDEN=TRUE AUTOSTART=TRUE> ') } //--></SCRIPT>
|
|
|
|
Joined: Oct 2002
Posts: 394
Enthusiast
|
Enthusiast
Joined: Oct 2002
Posts: 394 |
Thank you very much for trying. in what format should the .mid directory be written? I tried: I also tried this: <SCRIPT LANGUAGE="Javascript"><!-- function sound() { //Random Sounds } ; s = new sound() ; n = 0
src="http://www.romanianational.com/ubb/christmas/carols/" s[n++]= "betleem.mid" s[n++]= "cvapstori.mid" etc etc.. none of them work Felix
|
|
|
|
Joined: Jun 2001
Posts: 729
Coder
|
Coder
Joined: Jun 2001
Posts: 729 |
The line:
// - Sound Database -
Is just a remark line and is not intended to imply the need to chnage it.
Just enter the file names in between the quotes on these lines.
s[n++]= "Some.wav" s[n++]= "OrSome.mid" s[n++]= "Another.wav" s[n++]= "Again.mid" s[n++]= "And.wav" s[n++]= "sound.mid"
The actual file(s) should reside in the same directory as the file the script is being called from. Although untested you might be able to place the path there as well allowing you to keep the files in their own directory.
|
|
|
|
Joined: Oct 2002
Posts: 394
Enthusiast
|
Enthusiast
Joined: Oct 2002
Posts: 394 |
I understand. I've already done that. But it still doesnt work. I am not sure which is the directory though, I added this code in the header of the (seasonal) Christmas Style template, therefore I loaded these .mid files in the Templates folder ( http://romanianational.com/public_html/ubb/Templates/) Is that correct? Thank you Steven
|
|
|
|
Joined: Mar 2001
Posts: 7,394
Admin / Code Breaker
|
Admin / Code Breaker
Joined: Mar 2001
Posts: 7,394 |
I think you have to put the files in both the /cgi-bin (ultimatebb.cgi, for non-topic pages) and /ubb (ultimatebb.php, and also for topic loaded with ultimatebb.cgi) directories.
Note that Steven gave you the code to make it random, not according to the day.
|
|
|
|
Joined: Oct 2002
Posts: 394
Enthusiast
|
Enthusiast
Joined: Oct 2002
Posts: 394 |
I already tried LK. I wasnt sure where they're needed and I uploaded them in 3 directories, /ubb, /Templates and /cgi-bin. No music to my ears... Thank you.
|
|
|
|
Joined: Jun 2001
Posts: 729
Coder
|
Coder
Joined: Jun 2001
Posts: 729 |
Sorry I miss read the inital post on wanting it based on the day of week Try this... Change each document.write line's src= portion for the different songs you wish to play and their location. Also if you want the audio file to play "loop" change to true. <body>
<script language="JavaScript" type="text/javascript">
s_date = new Date();
if(s_date.getDay() == 1){ document.write('<embed width=0 height=0 hidden="true" autostart="true" volume="5" loop="false" src="AudioFile1.mp3">'); }
if(s_date.getDay() == 2){ document.write('<embed width=0 height=0 hidden="true" autostart="true" volume="5" loop="false" src="AudioFile2.mp3">'); }
if(s_date.getDay() == 3){ document.write('<embed width=0 height=0 hidden="true" autostart="true" volume="5" loop="false" src="AudioFile3.mp3">'); }
if(s_date.getDay() == 4){ document.write('<embed width=0 height=0 hidden="true" autostart="true" volume="5" loop="false" src="AudioFile4.mp3">'); }
if(s_date.getDay() == 5){ document.write('<embed width=0 height=0 hidden="true" autostart="true" volume="5" loop="false" src="AudioFile5.mp3">'); }
if(s_date.getDay() == 6){ document.write('<embed width=0 height=0 hidden="true" autostart="true" volume="5" loop="false" src="AudioFile6.mp3">'); }
if(s_date.getDay() == 7){ document.write('<embed width=0 height=0 hidden="true" autostart="true" volume="5" loop="false" src="AudioFile7.mp3">'); }
if(s_date.getDay() == 0){ document.write('<embed width=0 height=0 hidden="true" autostart="true" volume="5" loop="false" src="AudioFile0.mp3">'); } </script>
|
|
|
|
Joined: Oct 2002
Posts: 394
Enthusiast
|
Enthusiast
Joined: Oct 2002
Posts: 394 |
Steven, it doesnt matter if they work randomly or by day, as long as they work Right now they dont because I dont know what directory I should load the into. Is it the: /ubb/ /cgi-bin/ /Templates/ ? or all? thank you very much for your effort. Felix
|
|
|
|
Joined: Jun 2001
Posts: 729
Coder
|
Coder
Joined: Jun 2001
Posts: 729 |
Are you trying to implement this site wide to your UBB system or jsut a single webpage?
|
|
|
|
Joined: Oct 2002
Posts: 394
Enthusiast
|
Enthusiast
Joined: Oct 2002
Posts: 394 |
Just the UBB. http://romanianational.com/cgi-bin/ultimatebb.cgi And just the Summary page will suffice. Funny think is that it did work a little, and trully "random" indeed, only on the Topic page and on the PM page, can't figure that out because I uploaded (4 songs, true) in each of the above directories.
|
|
|
Donate to UBBDev today to help aid in Operational, Server and Script Maintenance, and Development costs.
Please also see our parent organization VNC Web Services if you're in the need of a new UBB.threads Install or Upgrade, Site/Server Migrations, or Security and Coding Services.
|
|
Posts: 69
Joined: January 2001
|
|
Forums63
Topics37,573
Posts293,925
Members13,849
|
Most Online5,166 Sep 15th, 2019
|
|
Currently Online
Topics Created
Posts Made
Users Online
Birthdays
|
|
|
|
|