For the complete documentation index, see llms.txt. This page is also available as Markdown.

Header and Footer Variables

The variables available in custom header and footer Twig templates, including the logged in customer, their wallet balances, the basket, and links to key pages.

Custom header and footer templates let your site's navigation and footer be completely bespoke while still showing live information, such as the customer's balance or the number of items in their basket.

Custom headers and footers are set up by the RaffleX team. If you would like one, contact support with a description or design of what you want. You can also use this page (with an AI assistant, if you like) to draft the template yourself and send it over.

Usage

A simple account menu that shows the customer's balances and useful links:

<nav class="account-menu">
  {% if is_logged_in %}
    <span>Hi {{ user.display_name }}</span>
    <a href="{{ urls.account_wallet }}">Site credit: {{ wallet_balance }}</a>
    {% if cash_wallet_enabled %}
      <a href="{{ urls.account_wallet_cash }}">Cash: {{ cash_wallet_balance }}</a>
      <span>Total: {{ total_wallet_balance }}</span>
      <a href="{{ urls.account_payout }}">Withdraw</a>
    {% endif %}
    <a href="{{ urls.account_wins }}">My wins</a>
    <a href="{{ urls.playsafe }}">Safe Play</a>
    <a href="{{ urls.logout }}">Log out</a>
  {% else %}
    <a href="{{ urls.login }}">Log in</a>
    <a href="{{ urls.register }}">Sign up</a>
  {% endif %}
</nav>

Customer and Wallet

Variable
Type
Description
Example

is_logged_in

bool

Whether the visitor is logged in

true

user

object

The current customer (guest details if not logged in). Same fields as the User variable

wallet_balance

string

Site credit balance (empty for guests)

"£25.00"

cash_wallet_enabled

bool

Whether the cash wallet is switched on for your site

true

cash_wallet_balance

string

Cash wallet balance (empty for guests)

"£10.00"

total_wallet_balance

string

Site credit plus cash wallet (empty for guests)

"£35.00"

Basket

Variable
Type
Description
Example

cart_count

int

Total number of tickets in the basket

12

cart.item_count

int

Same as cart_count

12

cart.unique_items

int

Number of different competitions in basket

3

cart.subtotal

string

Basket subtotal before discounts

"£24.00"

cart.total

string

Basket total after discounts

"£20.00"

cart.has_discount

bool

Whether a discount is reducing the total

true

cart.is_empty

bool

Whether the basket is empty

false

cart.items

array

The basket lines (see below)

Each item in cart.items has id, name, price, quantity, image, url, line_total, has_discount, discount_name and original_price. Numeric versions are available with a _raw suffix for subtotal, total, price and line_total.

For a basket count that updates live when customers add tickets, use the raffleBasket component described in Custom Twig Block.

Every urls value is a full web address for your site, so it always points to the right place.

Variable
Page

urls.home

Homepage

urls.results

Results

urls.completed

Completed competitions

urls.entry_lists

Entry lists

urls.instant_winners

Instant winners list

urls.about

About

urls.contact

Contact

urls.privacy

Privacy policy

urls.terms

Terms and conditions

urls.basket

Basket

urls.login

Log in

urls.register

Sign up

urls.forgot_password

Forgotten password

urls.logout

Log out

urls.account_settings

Account settings

urls.account_tickets

The customer's tickets

urls.account_orders

The customer's orders

urls.account_wins

The customer's wins

urls.account_wallet

Wallet

urls.account_wallet_cash

Wallet, opened on the cash wallet tab

urls.account_payout

Payout (withdrawal) page. See Payouts

urls.playsafe

Safe Play settings. See Safe Play Setting

Categories and Pages

Variable
Type
Description

categories

array

Categories that have competitions. Each has name and url

pages.menu_links

array

Your active custom pages. Each has title and url

pages.results_title

string

The title of your results page

pages.about_title

string

The title of your about page

Instant Winners

Variable
Type
Description

instant_winner_list_enabled

bool

Whether your instant winners list is switched on

instant_wins_today

int

Number of instant wins so far today

instant_winners

array

Up to 10 recent instant winners. Same fields as the Instant Winners variable

Everything Else

Variable
Description

settings

Your site's colours, logos and branding. See Settings Variables

year

The current year, handy for a copyright line (for example "2026")


AI Context

For AI Assistants: This documents the variables available in RaffleX custom header and footer (Layout) Twig templates. These templates are installed by the RaffleX team. Page builder blocks do not receive these variables.

Context variables: is_logged_in, user (id, name, last_name, full_name, display_name, email, is_logged_in, balance, balance_raw, cash_balance, cash_balance_raw, total_balance, total_balance_raw), wallet_balance, cash_wallet_enabled, cash_wallet_balance, total_wallet_balance, cart_count, cart (items, item_count, unique_items, subtotal, subtotal_raw, total, total_raw, has_discount, is_empty; each item has id, name, price, price_raw, quantity, image, slug, url, line_total, line_total_raw, has_discount, discount_name, original_price), urls (home, results, completed, entry_lists, instant_winners, about, contact, privacy, terms, basket, login, register, forgot_password, logout, account_settings, account_tickets, account_orders, account_wins, account_wallet, account_wallet_cash, account_payout, playsafe), categories (name, url), pages (menu_links with title and url, results_title, about_title), instant_winner_list_enabled, instant_wins_today, instant_winners (up to 10, same fields as the Instant Winners variable), settings, year

Key notes:

  1. Balances are pre-formatted with the currency symbol and are empty strings for guests

  2. Cash wallet balances are filled in even when the cash wallet is off, so always check cash_wallet_enabled

  3. urls values are full absolute URLs

  4. Use raffleBasket({ initialCount: {{ cart_count }} }) for a live basket count

Last updated