Skip to Content
It is currently October 15th, 2019, 8:36 am

All times are UTC - 6 hours [ DST ]




Post new topic Reply to topic  [ 5 posts ] 
Author Message
PostPosted: March 28th, 2019, 10:21 am 
Offline
Senior User
Senior User

Joined: July 23rd, 2007, 2:22 am
Posts: 117
I'd like to be able to display how many times a song has been played in the playlist.php file. I just need the bit of code that will show this, then I can add another column and put that in myself.

So when someone clicks "Playlist and Requests", they'll see the album artwork, artist and song title, the request button, the album name, the song duration, and the number of plays.

Thanks to anyone who can help.

_________________
Park Magic Radio
http://parkmagicradio.ca


Top
 Profile  
Reply with quote  
PostPosted: March 28th, 2019, 11:59 am 
Offline
SVS Member
SVS Member

Joined: December 6th, 2004, 9:00 am
Posts: 7878
Location: Aachen (Germany)
dan40 wrote:
I just need the bit of code that will show this, then I can add another column and put that in myself.

Add a variable public $count_played; to the list of fields in class.song.php, then access it via $playlistSong->count_played in display.playlist.php
There's no actual logic needed.

_________________
Benedikt Bauer - SVS (Spacial Volunteer Support)

We're offering custom PAL / PHP code and general SAM assistance at palscripts.com

My Project:
Send "Now Playing" from SAM to Twitter and/or Facebook | Sourcecode


Top
 Profile  
Reply with quote  
PostPosted: March 28th, 2019, 12:49 pm 
Offline
Senior User
Senior User

Joined: July 23rd, 2007, 2:22 am
Posts: 117
Thanks! I'll try that when I get home tonight and report back.

_________________
Park Magic Radio
http://parkmagicradio.ca


Top
 Profile  
Reply with quote  
PostPosted: March 28th, 2019, 5:45 pm 
Offline
Senior User
Senior User

Joined: July 23rd, 2007, 2:22 am
Posts: 117
Thanks @Mastacheata, it works!

I also used this method to create a column with the number of times a track has been requested, using
Code:
public $count_requested;
in the class.song.php file, and
Code:
<?php echo $playlistSong->count_requested; ?>
in the display.playlist.php file to display the data!

Cheers,
Dan

_________________
Park Magic Radio
http://parkmagicradio.ca


Top
 Profile  
Reply with quote  
PostPosted: April 5th, 2019, 10:04 pm 
Offline
Senior User
Senior User

Joined: July 23rd, 2007, 2:22 am
Posts: 117
@Mastacheata: How can I show the Song ID of the currently playing song?

EDIT: Never mind, I figured it out:

In class.song.php there is a line that says
Code:
public $ID;
and I just added the following code:
Code:
Song ID: <?php echo $currentSong->ID; ?>
into my display.playing.php file.

Seems to work just fine.

_________________
Park Magic Radio
http://parkmagicradio.ca


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 5 posts ] 

All times are UTC - 6 hours [ DST ]


Who is online

Users browsing this forum: Bing [Bot], Google [Bot], MSN [Bot] and 20 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group