---
title: "Register"
manual: "TypoScript Explained"
version: "main"
permalink: "https://docs.typo3.org/permalink/t3tsref:using-setting-register@main"
source: "UsingSetting/Register.rst"
rendered: "2026-09-19T06:55:14+00:00"
---

# Register {#using-setting-register}

It is possible to store variable values into a memory stack which is called
"register".  The cObjects [LOAD_REGISTER](https://docs.typo3.org/permalink/t3tsref:cobj-load-register@main) and
[RESTORE_REGISTER](https://docs.typo3.org/permalink/t3tsref:cobj-restore-register@main) provide this storage functionality.
Some TYPO3 cObjects use internal registers. Esp.  the menus are built by
registers (e.g. count_HMENU, count_HMENU_MENUOBJ, count_menuItems).

## Defining registers {#using-setting-register-defining-registers}

Registers in TypoScript can be seen as stack array variables in programming
languages. Each register can store a complex TypoScript block. Use
[LOAD_REGISTER](https://docs.typo3.org/permalink/t3tsref:cobj-load-register@main) to put a variable to the stack, use
[RESTORE_REGISTER](https://docs.typo3.org/permalink/t3tsref:cobj-restore-register@main) to pull a variable from the stack
and curly braces around a variable name to read the current value of the
variable. You need a [](https://docs.typo3.org/permalink/t3tsref:stdwrap-data@main) or a
[](https://docs.typo3.org/permalink/t3tsref:stdwrap-datawrap@main) cObject. The registers cannot be read
on other places than inside of these cObjects.

## Example {#using-setting-register-example}

**EXT:site_package/Configuration/Sets/Main/setup.typoscript**

```typoscript
10 = COA
10 {
  ### left menu table column
  10 = LOAD_REGISTER
  10 {
    ulClass = col-left
  }

  ### right menu table column
  20 = LOAD_REGISTER
  20 {
    ulClass = col-right
  }

  30 = HMENU
  30 {
    special = list
    special.value = 1
    1 = TMENU
    # ...
    3 = TMENU
    3 {
      stdWrap {
        preCObject = COA
        preCObject {
          10 = RESTORE_REGISTER
        }
        dataWrap = <ul class="{register:ulClass}">|</ul>
      }
      wrap =
      SPC = 1
      SPC {
        allStdWrap {
          replacement {
            10 {
              search = ---
              replace =
            }
          }
          dataWrap = </ul>|<ul class="{register:ulClass}">
        }
      }
    }
  }
}

```

This example shows a part of a TypoScript which builds a 2 column menu based on
a spacer page. A class is added to the ul tag depending on the value of the
register variable `ulClass`. The first pages will have the class `col-left` and
the pages following the spacer page will get the class `col-right`.

`{register:variablename}` returns the "current" value of the variable
`variablename`. A register stack can be like any TypoScript setup.

**EXT:site_package/Configuration/Sets/Main/setup.typoscript**

```typoscript
10 = COA
10 {
  10 = LOAD_REGISTER
  10 {
    ulClass = col-left
    aClass = a-special
    colors {
      chief = red
      servant = white
    }
  }
}

```

The "current" value is just an internal variable that can be used by functions
to pass a single value on to another function later in the TypoScript
processing. It is like "load accumulator" in the good old C64 days. Basically
you can use a "register" as you like. The TSref will tell if functions are
setting this value before calling some other object so that you know if it holds
any special information.
