Monthly Archives: December 2010

Dynamic mp3 playlist in Drupal 6

I tried generating dynamic playlists with swftools or jw player module without success, but finally got Views to generate a playlist feed imported into an embedded mp3 player on the fly. These are the modules needed:

  • CCK + filefield (for the mp3 files)
  • Views bonus pack (to export fields to XML).

And the embeded mp3 player that I used can be found in

The view filters by content of type song (in my case) and displays fields node title and the song content with a URL to file format. Adding a “path” as custom label for this last field helps to construct the correct xml tag for the mp3 player later. The view is displayed in a feed with a style of xml file and a path of playlist.xml for this example. At this point the supplied views-bonus-export-xml.tpl.php template file needs to be overriden to make it match with the xml file expected by the premiumbeat mp3 player (see the xml file that comes as an example with the player download). Instead of the <node> tags I used <item>, and I also needed to get rid of the <xml> tags and added <playlist>. The resulting file:

print '<?xml version="1.0" encoding="UTF-8" ?>';
<?php foreach ($themed_rows as $count => $row): ?>
<?php foreach ($row as $field => $content):
$label = $header[$field] ? $header[$field] : $field;
<<?php print $label; ?>><?php print $content; ?></<?php print $label; ?>>
<?php endforeach; ?>
<?php endforeach; ?>

The generated xml file looks like this:

<?xml version="1.0" encoding="UTF-8" ?><playlist>

The last thing needed is to embed in a block the player. The only thing we have to be careful with is the path, both to the xml playlist generated by the view and the actual mp3 player swf file.

--><script type="text/javascript" src=""></script>
<div id="player-holder">
<script type="text/javascript">
var options = {};
options.playlistXmlPath = "";

var params = {};
params.allowFullscreen = "true";
params.allowScriptAccess = "always";

swfobject.embedSWF("http:/", "player-holder", "250", "180", "9.0.0",false, options, params, {});
</script><!-- END PLAYER EMBED CODE -->

That´s all!


Allowing bigger size file uploads

To allow for bigger size file uploads, as with large mp3 files, tweak the values post_max_size and upload_max_filesize in the php.ini file.

login & ckfinder issues: setting the $cookie_domain variable

I have experienced ckfinder permission issues that are resolved by uncommenting and setting the $cookie_domain variable in the settings.php file to the domain name. If this is not configured right can lead into login issues (“Access denied…”). What works for me is to set up the variable as follows:

$cookie_domain = ‘’;

It is important to note that the dot after the comma can´t be forgotten.

This issue was explained and resolved here: