PLAYING AUDIO FILES ON A PAGE - Nov 18th, 2010


There are a number of choices here, just as with visual uploads.

The simplest way to include mp3 or wave audio on your page is to place a tag on your page, like this.

A multi record example:



<?php foreach ($your_sectionRecords as $record): ?>
<?php foreach ($record['audio_1'] as $upload): ?>
<a href="<?php echo $upload['urlPath'] ?>" target="_blank">Hear my song</a>
<?php endforeach ?> <?php endforeach ?>



And a single record editor example:



<?php foreach ($your_sectionRecord['audio_1'] as $upload): ?>
<a href="<?php echo $upload['urlPath'] ?>" target="_blank">Hear my song</a>
<?php endforeach ?>



If you want an image to appear instead of, or along with your text, you would insert the appropriate image display code
like this:



<a href="<?php echo $upload['urlPath'] ?>" target="_blank">
<?php foreach ($record['your_image'] as $upload): ?>
<img src="<?php echo $upload['thumbUrlPath'] ?>" width="<?php echo $upload['thumbWidth'] ?>" height="<?php echo
$upload['thumbHeight'] ?>" alt="" /><br />
<?php endforeach ?><br /><Hear my song</a>



If you wanted to have an audio file play automatically when the page loads and also embed a player control, you could
embed the following, with the autoplay values set to “true”. If you don’t want it to play automatically, set the
autoplay values to “false”.

For a multi record editor:



<?php foreach ($your_sectionRecords as $record): ?>
<?php foreach ($record['audio_1'] as $upload): ?>

<object width="300" height="42">
<param name="src" value="<?php echo $upload['urlPath'] ?>">
<param name="autoplay" value="true">
<param name="controller" value="true">
<param name="bgcolor" value="#FF9900">
<embed src="<?php echo $upload['urlPath'] ?>" autostart="true" loop="false" width="300" height="42"
controller="true" bgcolor="#FF9900"></embed>
</object>
<?php endforeach ?>
<?php endforeach ?>



For a single record editor:



<?php foreach ($your_editorRecord['audio_1'] as $upload): ?>

<object width="300" height="42">
<param name="src" value="<?php echo $upload['urlPath'] ?>">
<param name="autoplay" value="true">
<param name="controller" value="true">
<param name="bgcolor" value="#FF9900">
<embed src="<?php echo $upload['urlPath'] ?>" autostart="true" loop="false" width="300" height="42"
controller="true" bgcolor="#FF9900"></embed>
</object>
<?php endforeach ?>




The materials on this web site have been created for use with CMS Builder content management software. CMS Builder software is published and licensed for use by InteractiveTools.com. Please contact Interactive Tools for information on the downloading of the software or the purchasing of licenses.


Terms of Service