• Page 1 of 1
  • 1
Forum moderator: bigblog  
how to embed a list of past songs to web-site of radio??
Fireball
Posts: 3
Reputation: 0

Message # 1 | 0:08 AM
Dear guys and girls)
I have an Iradio (zbo.ucoz.com)
My listeners want to to know about three past artists and them songs, as well as the same information about a current track.

I would like to create the plugin and insert it bellow after player on the site.

Help me please to start do it) What should I do the first, the second ...

I have a little experience in programming and I will try to expand it for this "project")

The radion-station uses SAM Broadcaster, Icecast2, and free set of UCOZ service.

Thank you in advance.
In waiting for your help
Eriko
Pokémon Master
Posts: 962
Reputation: 34

Message # 2 | 2:12 AM
If you're using a third party application, go to their website and look for their API. Unfortunately, we won't be helping users with custom scripting.
gstcalculator002
Posts: 3
Reputation: 0

Message # 3 | 7:43 AM
Sure, I can help you with that. Here are the steps on how to create a plugin to show the past artists and songs on your radio station:

Create a new PHP file

The first step is to create a new PHP file. You can name it whatever you want, but I recommend something like past-artists-songs.php.

Connect to the database

In the PHP file, you need to connect to the database that stores your radio station's data. You can do this by using the mysqli library.

Query the database

Once you have connected to the database, you need to query it to get the list of past artists and songs. You can do this by using the following SQL query:

SQL
SELECT artist, title
FROM songs
ORDER BY played DESC
LIMIT 3;
Use code with caution. Learn more
This query will return the three most recently played songs, along with their artists.

Parse the results

Once you have the results of the query, you need to parse them into an array. You can do this by using the following code:

PHP
$results = $mysqli->query($query);

$past_artists_songs = [];

while ($row = $results->fetch_assoc()) {
$past_artists_songs[] = [
'artist' => $row['artist'],
'title' => $row['title'],
];
}
Use code with caution. Learn more
This code will create an array called past_artists_songs. Each element in the array will contain the artist and title of a past song.

Display the results
Finally, you need to display the results of the query on your website. You can do this by using the following code:

PHP
foreach ($past_artists_songs as $past_artist_song) {
echo '<p>' . $past_artist_song['artist'] . ' - ' . $past_artist_song['title'] . '</p>';
}
Use code with caution. Learn more
This code will loop through the past_artists_songs array and display each element as a paragraph.

Once you have completed these steps, you will have created a plugin that will show the past artists and songs on your radio station. You can then insert this plugin into your website's code. https://spotibuzz.com/

I hope this helps! Let me know if you have any other questions.
Post edited by gstcalculator002 - Tuesday, 2023-09-12, 8:43 AM
  • Page 1 of 1
  • 1
Search: