Playing Track Function

4 posts by 2 authors in: Forums > CMS Builder
Last Post: November 26, 2010   (RSS)

By Joseph - November 25, 2010

I currently have a list of current tracks on my home page - http://www.socanews.com/index3.php which when a track is cliked goes to the folloing page - http://www.socanews.com/music/ however the track doesnt automatically play. what would i need to do to enable this function?

This is the current code for the track list on the home page:
<?php foreach ($toptracksRecords as $track): ?>
<?php @$artist = getArtist($track['artists']); ?>
<?php foreach ($track['upload'] as $upload): ?>
<?php if ($upload['hasThumbnail']): ?>
<?php continue; ?>
<?php else: ?>
<?php if (@$artist[0]['image']): ?>
<img src="<?php echo @$artist[0]['image'][0]['urlPath']; ?>" width="75" border="0" style="float: left; padding-right: 2px;" />
<?php else: ?>

<?php endif; ?>

<a href="./music" class="articleContentBold"><?php echo $track['title'] ?></a>|&nbsp; <?php echo $track['artists'] ?><br/>
<span class="eventIndexMore"><?php echo $track['country'] ?> | <?php echo $track['album_riddim'] ?> | <?php echo $track['year'] ?> | <?php echo $track['plays']; ?> Plays</span><br/>
<div style="background-color: #C0DEED; height: 1px; width: 100%; margin: 10px 0 5px 0;"> </div>
<?php endif; ?>
<?php endforeach; ?>

<?php endforeach ?>

Re: [socanews] Playing Track Function

By Chris - November 25, 2010

Hi socanews,

Could you please post the complete PHP source code for your list page and music page?
All the best,
Chris

Re: [socanews] Playing Track Function

By Chris - November 26, 2010

Hi socanews,

From the code you posted, I can see that your links don't contain any information on which track to play:

<a href="./music" ...

You'll need to add some information to your URLs to identify tracks. For example:

<a href="./music?trackNum=<?php echo $record['num']; ?>" ...

From looking at the source of one of the URLs you posted earlier, it seems like you'll need to output some JavaScript to get the selected track playing.
All the best,
Chris