I made 5 FileFields ( nr1 nr2 nr3 nr4 nr5 ) for uploading 5 mp3 files.

I like to play the files in 1 Pixel Out MP3 Player seperate.

this is what I put in Content Templates


<?php if ($field_nr1[0]): ?>
<?php print swf($node->field_nr1[0]['filepath']); ?>
<?php endif; ?>

<?php if ($field_nr2[0]): ?>
<?php print swf($node->field_nr2[0]['filepath']); ?>
<?php endif; ?>

<?php if ($field_nr3[0]): ?>
<?php print swf($node->field_nr3[0]['filepath']); ?>
<?php endif; ?>



<?php if ($field_nr4[0]): ?>
<?php print swf($node->field_nr4[0]['filepath']); ?>
<?php endif; ?>

<?php if ($field_nr5[0]): ?>
<?php print swf($node->field_nr5[0]['filepath']); ?>
<?php endif; ?>



it works if I upload 5 mp3 files.

but if I upload 2 mp3 files

I get 2 files played and 3 times :

No player is configured to play a series mixed media files. Check the SWF Tools file handling settings on the configuration page.

any help please?? and sorry for my english

Comments

Stuart Greenfield’s picture

I can't remember file field syntax offhand, but you are testing against

$field_nr1[0]

but rendering

$node->field_nr1[0]['filepath']

Is $field_nr1[0] available when you perform the test, or should it be $node->field_nr2[0]['filepath']

Alternatively, the test only looks to see if the array is empty. If the array ISN'T empty, but doesn't contain a filepath then the test will succeed, but there will be no content to look at. So you could also try a more specific test with something like

if ($field_nr1[0]['filepath'] != '')

or is that

if ($node->field_nr1[0]['filepath'] != '')
Stuart Greenfield’s picture

You might want to check out version 6.x-2.4 as that supports CCK directly. You could create a filefield that handles multiple uploads, and assign the formatter as SWF Tools (either with or without download), and you get as many instances of the player as you need.

There is also an enhanced CCK version on its way, and that will turn multiple uploads in to a playlist in a player, so you can have one player to playback the content.

These solutions might be something you can use in place of manually writing code, and if you want more than five uploads that's fine!