Return to Snippet

Revision: 55568
at February 11, 2012 11:39 by poot26


Initial Code
<?php		
	$time = date(G);  // Get the hour of day
			
			
	// Match the hour of the day to the proper track and set to autoplay and loop
	if ($time == 0) {
		echo "<audio id='audio_1' controls preload autoplay='autoplay' loop><source src='music/12-am.mp3' /></audio>";
	}elseif ($time == 1) {
		echo "<audio id='audio_1' controls preload autoplay='autoplay' loop><source src='music/1-am.mp3' /></audio>";
	} elseif ($time == 2) {
		echo "<audio id='audio_1' controls preload autoplay='autoplay' loop><source src='music/2-am.mp3' /></audio>";
	} elseif ($time == 3) {
		echo "<audio id='audio_1' controls preload autoplay='autoplay' loop><source src='music/3-am.mp3' /></audio>";
	} elseif ($time == 4) {
		echo "<audio id='audio_1' controls preload autoplay='autoplay' loop><source src='music/4-am.mp3' /></audio>";
	} elseif ($time == 5) {
		echo "<audio id='audio_1' controls preload autoplay='autoplay' loop><source src='music/5-am.mp3' /></audio>";
	} elseif ($time == 6) {
		echo "<audio id='audio_1' controls preload autoplay='autoplay' loop><source src='music/6-am.mp3' /></audio>";
	} elseif ($time == 7) {
		echo "<audio id='audio_1' controls preload autoplay='autoplay' loop><source src='music/7-am.mp3' /></audio>";
	} elseif ($time == 8) {
		echo "<audio id='audio_1' controls preload autoplay='autoplay' loop><source src='music/8-am.mp3' /></audio>";
	} elseif ($time == 9) {
		echo "<audio id='audio_1' controls preload autoplay='autoplay' loop><source src='music/9-am.mp3' /></audio>";
	} elseif ($time == 10) {
		echo "<audio id='audio_1' controls preload autoplay='autoplay' loop><source src='music/10-am.mp3' /></audio>";
	} elseif ($time == 11) {
		echo "<audio id='audio_1' controls preload autoplay='autoplay' loop><source src='music/11-am.mp3' /></audio>";
	} elseif ($time == 12) {
		echo "<audio id='audio_1' controls preload autoplay='autoplay' loop><source src='music/12-pm.mp3' /></audio>";
	} elseif ($time == 13) {
		echo "<audio id='audio_1' controls preload autoplay='autoplay' loop><source src='music/1-pm.mp3' /></audio>";
	} elseif ($time == 14) {
		echo "<audio id='audio_1' controls preload autoplay='autoplay' loop><source src='music/2-pm.mp3' /></audio>";
	} elseif ($time == 15) {
		echo "<audio id='audio_1' controls preload autoplay='autoplay' loop><source src='music/3-pm.mp3' /></audio>";
	} elseif ($time == 16) {
		echo "<audio id='audio_1' controls preload autoplay='autoplay' loop><source src='music/4-pm.mp3' /></audio>";
	} elseif ($time == 17) {
		echo "<audio id='audio_1' controls preload autoplay='autoplay' loop><source src='music/5-pm.mp3' /></audio>";
	} elseif ($time == 18) {
		echo "<audio id='audio_1' controls preload autoplay='autoplay' loop><source src='music/6-pm.mp3' /></audio>";
	} elseif ($time == 19) {
		echo "<audio id='audio_1' controls preload autoplay='autoplay' loop><source src='music/7-pm.mp3' /></audio>";
	} elseif ($time == 20) {
		echo "<audio id='audio_1' controls preload autoplay='autoplay' loop><source src='music/8-pm.mp3' /></audio>";
	} elseif ($time == 21) {
		echo "<audio id='audio_1' controls preload autoplay='autoplay' loop><source src='music/9-pm.mp3' /></audio>";
	} elseif ($time == 22) {
		echo "<audio id='audio_1' controls preload autoplay='autoplay' loop><source src='music/10-pm.mp3' /></audio>";
	} elseif ($time == 23) {
		echo "<audio id='audio_1' controls preload autoplay='autoplay' loop><source src='music/11-pm.mp3' /></audio>";
	} // end if
		?>

Initial URL

                                

Initial Description
Php conditionals to echo proper audio tags

Initial Title
Php conditionals to echo proper audio tags

Initial Tags
php, html, html5

Initial Language
HTML