Forums / Cotonti / Support / sql queries in header.main

booka
#23844 2010-03-30 04:02
dunno why, but it is not working...(((

where is mistake?

<?PHP
/* ====================
[BEGIN_SED_EXTPLUGIN]
Code=jQPlayer
Part=header
File=jQPlayer.header
Hooks=header.main
Tags=header.tpl:{HEADER_COMPOPUP}
Order=10
[END_SED_EXTPLUGIN]
==================== */

defined('SED_CODE') or die('Wrong URL');

$sql = sed_sql_query("SELECT * FROM `sed_jqplayer_playlist`");

while($row = sed_sql_fetcharray($sql))
$i=1;
{
$track .= "{name:\"".$row['track_artist']." - ".$row['track_song']."\",mp3:\"".$row['track_loc']."\"}";
	if ($i<sed_sql_numrows($sql)) { $track .= ", "; }
$i++;
}
	
$out['compopup'] .= '

<script type="text/javascript" src="js/jquery.jplayer.min.js"></script>

<script>

$(document).ready(function(){

var playItem = 0;

	var myPlayList = [ '.$track.' ];

	// Local copy of jQuery selectors, for performance.
	var jpPlayTime = $("#jplayer_play_time");
	var jpTotalTime = $("#jplayer_total_time");


   $("#jquery_jplayer").jPlayer({
		ready: function () {
			displayPlayList();
			playListInit(false); // Parameter is a boolean for autoplay.			
		},
	swfPath: "/js", nativeSupport: true, oggSupport: false,
	customCssIds: false
	})
	
	.jPlayer("onProgressChange", function(loadPercent, playedPercentRelative, playedPercentAbsolute, playedTime, totalTime) {
		jpPlayTime.text($.jPlayer.convertTime(playedTime));
		jpTotalTime.text($.jPlayer.convertTime(totalTime));
	})
	
	.jPlayer("onSoundComplete", function() {
		playListNext();
	});

	$("#jplayer_previous").click( function() {
		playListPrev();
		return false;
	});

	$("#jplayer_next").click( function() {
		playListNext();
		return false;
	});

	function displayPlayList() {
		for (i=0; i < myPlayList.length; i++) {
			$("#jplayer_playlist ul").append("<li id=\'jplayer_playlist_item_"+i+"\'>"+ myPlayList[i].name +"</li>");
			$("#jplayer_playlist_item_"+i).data( "index", i ).click( function() {
				var index = $(this).data("index");
				if (playItem != index) {
					playListChange( index );
				} else {
					$("#jquery_jplayer").jPlayer("play");
				}
			});
		}
	}

	function playListInit(autoplay) {
		if(autoplay) {
			playListChange( playItem );
		} else {
			playListConfig( playItem );
		}
	}

	function playListConfig( index ) {
		$("#jplayer_playlist_item_"+playItem).removeClass("jplayer_playlist_current");
		$("#jplayer_playlist_item_"+index).addClass("jplayer_playlist_current");
		playItem = index;
		$("#jquery_jplayer").jPlayer("setFile", myPlayList[playItem].mp3, myPlayList[playItem].ogg);
	}

	function playListChange( index ) {
		playListConfig( index );
		$("#jquery_jplayer").jPlayer("play");
	}

	function playListNext() {
		var index = (playItem+1 < myPlayList.length) ? playItem+1 : 0;
		playListChange( index );
	}

	function playListPrev() {
		var index = (playItem-1 >= 0) ? playItem-1 : myPlayList.length-1;
		playListChange( index );
	}


});

</script>';


$out['compopup'] .= '<link rel="stylesheet" type="text/css" href="plugins/jQPlayer/jQPlayer.css" />';

?>


Добавлено 3 Минуты спустя:

oooooooouuuuuuuuuuuuuuuhhhhhhhhhhhh... shit... I'm stupid lazy dumb ass...)))

Found and fixed
booka