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

Jamroom Artist EPK (Electronic Press Kit) Index Adding Pages and Creating New Templates in your Jamroom

Working with the Jamroom 4 Templates

Jamroom uses the idea of a "template" throughout much of the program - you won't get far in customizing your Jamroom without running in to the need to edit a template.  A "template" can be thought of as part of a page that you would see in your browser - there may be several different templates that construct an entire page (for example, a "header" template, a "row" (or body) template and a "footer" template).  Some pages may only use one template, while other pages can consist of a number of different templates, all pieced together to create the finished output HTML.

Jamroom uses  the Smarty Template engine for all of the Jamroom templates.  Smarty is a very powerful templating system, that is easy to use once you understand the basic idea of how a template works.  All Jamroom templates end with the extension ".tpl", and for the most part are HTML files with embedded Smarty variables, functions and modifiers.

It is HIGHLY recommended to spend some time on the Smarty web site:

http://smarty.php.net

as it contains a lot of information about Smarty, extending Smarty, and on line documentation that shows you the syntax and functions you can use in your Jamroom templates:

http://smarty.php.net/docs.php

Jamroom also contains an extensive amount of Custom Smarty functions and modifiers that you can use within your Jamroom templates to work with the specific Jamroom features.

Jamroom Template Variables

Within a Jamroom Template file, you will see that the template consists of mainly HTML code, but also contains some other unique looking syntax.  For example, in this small template file:

<html>
<body>
Welcome to Jamroom, {$_USER.user_nickname}!
</body>
</html>

You can see that it is a (very) simple HTML file, with some text and a specially formatted word:

{$_USER.user_nickname}

This is a "Template Variable".  In this case, this is a small Jamroom Index template, and the "variable" would be replaced by the viewers login name when viewing, so if you were logged in as the Jamroom "admin", when viewing this template you would see:

Welcome to Jamroom, admin!

So you can think of variables as "placeholders", where other information will be dynamically placed when the template is viewed.  One important thing to note is that all template variables have a dollar sign ($) at the beginning.

Jamroom Template Functions

Another unique item you will see within Jamroom templates are what are known as "Template Functions".  Similar to a template variable, a template function will be "executed" when the template is viewed.  This allows for additional functionality to be brought into the template that may otherwise not be possible.  This is a common way for additional "blocks" of Jamroom data to be pulled into a Jamroom template.  For example, the following template contains the {jr_ranking} template function:

<html>
<body>
{jr_ranking mode="spotlight" row_template="jr_spotlight_row.tpl"}
</body>
</html>

This small template will run a Jamroom Ranking System "function" call, which in this case returns a "spotlight" of a song in your Jamroom.  One important distinction between Template Variables and Template Functions is that the Template Function does not contain a dollar sign ($) after the opening bracket.


Jamroom Artist EPK (Electronic Press Kit) page 85 of 171 Adding Pages and Creating New Templates in your Jamroom
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
Documentation
Support Center
Contact Support
Community Forum
Member Sites
Developers
About Us
Contact Us
Privacy Policy
©2003 - 2024 The Jamroom Network