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

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

{jr_theme_template} Index Working with Jamroom Templates


While customizing your Jamroom System, you may find that you would like to change the index.php page, or home page, for your Artist/Member themes.  By default, this page is set as the "Blog" page for your members and artists.  With a few modifications, however, you can make any theme page the home page for your theme.

Step 1 - Decide which page you want to be your new index.php page

The first step to changing the index.php page is to decided which page you want to become your "new" index.php page.  This can be an already-existing page or a new page.

To illustrate how to change the theme homepage (the Blog page), this guide will change the Audio page in the default Cobalt theme to the home page.

Step 2 - Open the theme.cfg file inside the theme directory (Cobalt) for editing

The next step in changing the theme homepage is to open the theme.cfg file, found inside your current theme directory (Cobalt).  You can use any text editor or the built in template editor found in the Admin Control Panel (jamroom tools > edit templates) of your Jamroom site.  An unmodified Cobalt theme.cfg file will look like this::


# Jamroom "Cobalt" Artist Theme logic config file
# copyright 2006 Talldude Networks, LLC.

                    side.tpl | side.php

                  header.tpl | index.php
          message_header.tpl | index.php
                 message.cfg | index.php
          message_footer.tpl | index.php
                  footer.tpl | index.php

              artist_bio.tpl | biography.php

                  header.tpl | albums.php
            album_header.tpl | albums.php

                  header.tpl | audio.php
        song_list_header.tpl | audio.php
               song_list.cfg | audio.php
        song_list_footer.tpl | audio.php
                  footer.tpl | audio.php

                  player.tpl | player.php

            album_footer.tpl | albums.php
                  footer.tpl | albums.php

                  header.tpl | video.php
       video_list_header.tpl | video.php
              video_list.cfg | video.php
       video_list_footer.tpl | video.php
                  footer.tpl | video.php

                  header.tpl | photo.php
            photo_header.tpl | photo.php
              photo_list.cfg | photo.php
            photo_footer.tpl | photo.php
                  footer.tpl | photo.php

                  header.tpl | store.php
            store_header.tpl | store.php
              store_list.cfg | store.php
            store_footer.tpl | store.php
                  footer.tpl | store.php

                  header.tpl | event.php
         calendar_header.tpl | event.php
           calendar_list.cfg | event.php
         calendar_footer.tpl | event.php
                  footer.tpl | event.php

                  header.tpl | radio.php
            radio_header.tpl | radio.php
              radio_list.cfg | radio.php
            radio_footer.tpl | radio.php
                  footer.tpl | radio.php

                  header.tpl | chart.php
            chart_header.tpl | chart.php
             chart_entry.tpl | chart.php
            chart_footer.tpl | chart.php
                  footer.tpl | chart.php

                  header.tpl | fans.php
              fan_header.tpl | fans.php
                fan_list.cfg | fans.php
              fan_footer.tpl | fans.php
                  footer.tpl | fans.php

                  header.tpl | vault.php
            vault_header.tpl | vault.php
              vault_list.cfg | vault.php
            vault_footer.tpl | vault.php
                  footer.tpl | vault.php

In this file, you can see that each line of the file is constructed like this:

(template).tpl | (output_page).php

The file on the left will always be either a template file (.tpl extension) or a config file (.cfg extension), and the file on the right will typically be a php file (.php extension).  The Jamroom theme engine parses the files from top to bottom, taking the content from the template file before the pipe separator ("|") and outputs the contents of that template to the php page specified on the right of the pipe separator in each artist/member directory using that theme.  For example, this block of code constructs the index.php page (the Blog page) from the example above:

                  header.tpl | index.php
          message_header.tpl | index.php
                 message.cfg | index.php
          message_footer.tpl | index.php
                  footer.tpl | index.php


Step 3 - Changing the homepage from the Blog page to another page

For this guide, we will change the Audio page to the homepage.  In order to do this, we need to do two things: create a new template (index.tpl) and modify the output filenames in the theme.cfg.  First, we will create our new "index" template, which will be used to make sure we do not experience any problems if we want the index pages for artists and members to be different.  This also allows different quotas to have different index.php pages.  Create your index.tpl file and place it in your current theme directory (in this case, themes/Cobalt).  Place the following code inside:


{if $BAND_QUOTA < 0}
    {jr_theme_php_include file="`$ARTIST_DIR`/blog.php"}
{elseif $BAND_QUOTA > 0}
    {jr_theme_php_include file="`$ARTIST_DIR`/audio.php"}

Then, modify your theme.cfg to reflect the following changes:

                   index.tpl | index.php

                  header.tpl | blog.php
          message_header.tpl | blog.php
                 message.cfg | blog.php
          message_footer.tpl | blog.php
                  footer.tpl | blog.php

                  header.tpl | audio.php
        song_list_header.tpl | audio.php
               song_list.cfg | audio.php
        song_list_footer.tpl | audio.php
                  footer.tpl | audio.php

Let's take a look at what we've done.  We'll start with the theme.cfg.  First, we added a new template and told it to parse to the index.php page (it will be the ONLY template to parse directly to the index.php page).  Then, we created unique names for all of our other pages (namely, changing the output page of the original index.php (the blog page) to blog.php.

Now let's look at the index.tpl file.  This is where all of the "magic" happens.  Basically, the index.tpl file checks to see which quota each band is in.  If the profile is in an artist quota, we include the audio.php page, essentially making the index.php and audio.php pages one and the same.  If the profile is in a member quota, we include the blog.php page, again essentially making the index.php and blog.php pages one and the same.  This is the reason that unique page names are needed.  If you simply removed the blog section and renamed the output file of the song templates from audio.php to index.php, then the "Songs" page would also become the index.php page for members, who do not have audio, creating a blank page.  The great part about the index.tpl file we made is that we can make it extremely flexible, for instace, we might do this:


{* this will be the index page for "member" quotas *}
{if $BAND_QUOTA < 0}
    {jr_theme_php_include file="`$ARTIST_DIR`/blog.php"}
{* this will be the index page for "artist" quotas *}
{elseif $BAND_QUOTA > 0 && $BAND_QUOTA !== 3}
    {jr_theme_php_include file="`$ARTIST_DIR`/audio.php"} 
{* this will be the index page for our "directors" quota, which is quota_id 3*}
{elseif $BAND_QUOTA == 3}
    {jr_theme_php_include file="`$ARTIST_DIR`/video.php"}

By following this model and using a little creativity, you could create a different index page for each one of your quotas.

Note: After changing the homepage, you will most likely want to modify the menu.tpl file in the themes/Cobalt directory as well to reflect the changes you have made to the artists/member profile structure (i.e. remove/update the Blog button on the artist menu bar, change the order of menu bar buttons, etc.).  The method above allows for some "backwards" compatibility as well, so that no page will ever be "not found."  Artists can link to both their index.php and audio.php pages, and they will both show the same thing.


Step 4 - Regenerate your sites

After you have made the necessary changes to each of the theme files that you modified, regenerate your artist/member sites from the jamroom tools > regenerate sites.  If you do not do this the changes will not be made for each artist/member until each artist/member rebuilds their respective site.

You're done!  Following these steps, you can change any page to be the homepage of your artist/member themes.

Additional Resources

If you have any questions no this guide, or would like add comments or suggestions, please join us in the Jamroom User Support forums.  Thanks!

{jr_theme_template} page 111 of 185 Working with Jamroom Templates
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 - 2023 The Jamroom Network