Jamroom Logo Jamroom 5 Core
is now Open Source!
Follow Jamroom on Twitter!

This document applies to Jamroom 2 only!
For current Jamroom 4 Documentation, visit the main Jamroom Documentation section.

One of the “hidden” features of the Jamroom Ranking System is the ability to create dynamic custom playlists that your users can stream. This allows you almost unlimited ways to create new playlists (or “stations”) and offer them to your listeners. Creating these custom playlists requires undestanding how the Jamroom Ranking System works - I highly suggest reading the Using the Jamroom Ranking System documentation to ensure you understand the concepts that are need to create these dynamic playlists.

Create the Ranking template

The first step will be to create the JRS template that will be used to “click” on the link that starts the playlist stream. This template will actually be a very small template, since in effect all it needs to provide is the URL to the play.php script that has been generated by the ranking.php script. For our example here, we are going to create a random playlist of Hard Rock songs from our Jamroom. So in this first step we are going to create a file called “random_hard_rock.tpl”.

Note that ALL templates for the Jamroom Ranking System must be located in the jamroom/templates/ranking directory

<a href="{$PLAYALL_HIFI_MP3_URL}">Click here to play 25 random Hard Rock songs!</a>

Save this file as “random_hard_rock.tpl” in your jamroom/templates/ranking directory.

Create the Jamroom Ranking System call

The next step requires that you know the page you want to place the link in that your visitors will click on to stream this playlist. As an example here we will use “test.php”, but note that this can be any PHP page (such as your index.php home page) or any .shtml (SSI) page (such as index.shtml). Within our “test.php” script we will place this bit of code 1):


Make sure and change the “yoursite.com” to your actual domain name, and save this in a file called “test.php” in your Jamroom directory.

Test the Playlist created by the JRS

Now, if you load test.php in your browser:


You will see the text of the template you created in step one on your screen - “Click here to play 25 random Hard Rock songs!”. Clicking on that link will launch your audio player and the songs should begin streaming to your computer.

Understanding how it works

Now that you have a simple, working example of how to create a playlist, you can “experiment” with different options to ranking.php (note that you will always use the song mode) to get any type of list you want.

How the Jamroom Ranking System does this is because of the {$PLAYALL_HIFI_MP3_URL} template variable. This variables is available in the Header/Footer templates for the ranking system when running in the song mode. Since a “row_template” variable is not given, when Jamroom loops over the songs, but instead of adding the song variables to any output, the only thing that is created is the Header/Footer variables. Since the {$PLAYALL_HIFI_MP3_URL} is a header variable, it is available in the defined header template - in this case “random_hard_rock.tpl”. That variable will be expanded by Jamroom to the correct play.php call that is needed to stream the songs that match your ranking.php call.

NOTE: Jamroom caches all of the Jamroom Ranking System output pages to improve system performance, and to lessen the strain on your server if your server is very busy. This will affect the playlist that is generated by the ranking.php script since it will serve up the “cached” version of the play.php call for a duration that matches the “Cache Expires” setting in the Jamroom Config. This is typically not an issue for systems, but is something to be aware of during testing. If you would like to temporarily “disable” the caching effect, set the “Cache Expires” setting to 0 (zero) in the Jamroom Config. Just don’t forget to set it back to what it was when you are done testing!

1) Note that the word “Hard Rock” in the example URL has been PHP Urlencoded where all spaces or special characters have been replaced with the correct URL entity. In this case, a “space” is replaced with a + (plus sign)
Solutions Products Support Community Company
Social Media Platform
Social Networking Software
Musician Website Manager
Community Builder
Jamroom 5
Jamroom 5 Modules
Jamroom Marketplace
Support Forum
Support Center
Contact Support
Community Forum
Member Sites
About Us
Contact Us
Privacy Policy
©2003 - 2024 The Jamroom Network