Template Blocks

Applies to: Jamroom 7.0+ Last verified: 2026-10-24
  • What a template block is

    Jamroom templates use Smarty 4. A template block wraps part of a template, from an opening tag to a closing tag, and decides whether or how often that part is shown. Template functions, such as {jrCore_list}, are a single tag instead.

    {if jrUser_is_logged_in()}
        <a href="{$jamroom_url}/user/logout">Log out</a>
    {/if}
  • The part between {if ...} and {/if} is shown only when the condition is true. Add {else} for the other case, and put ! before a condition for "not".

  • The blocks you'll use most

    Block What it does
    {if}...{/if} Shows a part when a condition is true. See the condition pages below.
    {foreach}...{/foreach} Repeats a part for each item in a list. See {foreach}.
    {literal}...{/literal} Leaves JavaScript and CSS untouched by Smarty. See {literal}.
  • Conditions for {if}

    These Jamroom functions are made for {if}:

    You can also test any template variable, such as {if $profile_quota_id == 2}. {debug} shows the variables a template has.

    The Smarty documentation explains every block and operator.

Tags