Tutorial : Flash + CMS mp3 play list & player

This tutorial is designed to show you how to have one of the many XML driven Flash mp3 players to list the songs uploaded to your CMS website. This example uses the Joomla CMS with the User Home Pages 2 component used to upload thet .mp3 files to user pages. A live example can be found at the bottom of the left menu on Smart-Love.ca.

First we will need our Flash mp3 player. I am using the WebPod free ‘iPod-like’ player, also available in ‘slim’, which can be displayed in white or black. This also comes with the popular swfobject and js-to-flash .js files to overcome IE embedding problems. Follow the included instructions to display the player on your website where you want it. I suggest doing this in a .php file to make things easier later on when we get to the playlist. Joomla has a mambot that is used to include .php files into content or modules which works great for this.

Next we need to setup the XML feed. Make a new .php file and set the path for this file in the flash script you already have. The feed needs to output a simple XML file for your detailed sont information and path. Below is an example of my XML feed .php file with the database connection information removed. Since I am using User Homepages 2, which saves the page information object as a string to the database, we have to first convert the string back into an object then into an array to properly call the data inside of it.


 $val) {
		$val = (is_array($val) || is_object($val)) ? object_to_array($val) : $val;
		$arr[$key] = $val;
	}
	return $arr;
}

while ($row = mysql_fetch_assoc($result)) {
	$pd_obj = unserialize($row['pagedata']);
	$pd_ary = object_to_array($pd_obj);

	foreach ($pd_ary[song_file] as $key=>$value)
	{
		if($value !== “”){
		?>

			http://smart-love.ca/media/uhp2/
			
			192
			
				
			http://smart-love.ca/index.php?option=com_uhp2&task=viewpage&user_id=

		

For the play list just copy this page as a new .php file and modify the output to display instead the javascript links used to play the songs in the player. Use the include function to include this playlist.php file on the same page as the player. You should be done.

One thought on “Tutorial : Flash + CMS mp3 play list & player

  1. Sorry there are some formatting issues with this code here. WordPress is commenting out all the PHP tags. Please un-comment and re-apply formatting. thanks.

Comments are closed.