---
title: "Code blocks"
manual: "TypoScript Explained"
version: "main"
permalink: "https://docs.typo3.org/permalink/t3tsref:typoscript-syntax-syntax-curly-brackets@main"
source: "Syntax/CodeBlocks/Index.rst"
rendered: "2026-09-18T05:17:19+00:00"
---

# Code blocks {#code-blocks}

Curly braces can be used to structure identifier paths in a more efficient way:
Without repeating upper parts of a path in each line. This allows nesting.

Example without braces:

**Extension examples, file Configuration/TypoScript/Syntax/CodeBlock/setup.typoscript**

```typoscript
myIdentifier = TEXT
myIdentifier.stdWrap.field = title
myIdentifier.stdWrap.ifEmpty.data = leveltitle:0

```

This can be written as:

**Extension examples, file Configuration/TypoScript/Syntax/CodeBlock2/setup.typoscript**

```typoscript
myIdentifier = TEXT
myIdentifier {
  stdWrap.field = title
  stdWrap.ifEmpty.data = leveltitle:0
}

```

Curly braces can be nested to further improve readability. This is also
the same as above:

**Extension examples, file Configuration/TypoScript/Syntax/CodeBlock3/setup.typoscript**

```typoscript
myIdentifier = TEXT
myIdentifier {
  stdWrap {
    field = title
    ifEmpty {
      data = leveltitle:0
    }
  }
}

```

Some rules apply during parsing:

-   Everything on the same line after the opening `{` and closing
    `}` brace is considered a comment, even if the comment markers
    `#`, `//` and `/* ... */` are missing.
-   The closing brace `}` must be on a single line in order to close a block.
    The following construct is invalid, the closing brace is interpreted as part of
    the value, so the TypoScript and TSconfig backend modules will mumble with a
    "missing closing brace" warning:

    **Extension examples, file Configuration/TypoScript/Syntax/CodeBlockInvalidClosingBrace/setup.typoscript**

    ```typoscript
    myIdentifier = TEXT
    myIdentifier {
      value = bar }

    ```
-   Conditions can not be placed within blocks, they are always "global" level
    and stop any brace nesting. The following construct is invalid, the TypoScript and
    TSconfig backend modules will mumble with a "missing closing brace" warning:

    **Extension examples, file Configuration/TypoScript/Syntax/CodeBlockInvalidCondition/setup.typoscript**

    ```typoscript
    myIdentifier = TEXT
    myIdentifier {
      value = foo
      [frontend.user.isLoggedIn]
      value = bar
      [end]
    }

    ```
-   Nesting is per-file / per-text-snippet: It does not "swap" into included files. This
    was the case with the old TypoScript parser. It has been a nasty side-effect, leading
    to hard to debug problems. File includes with `@import`
    within curly braces are not relative (anymore).

    A construct like this is invalid, the TypoScript and TSconfig backend modules will mumble
    with a "missing closing brace" warning:

    **Extension examples, file Configuration/TypoScript/Syntax/CodeBlockInvalidCondition/setup.typoscript**

    ```typoscript
    myIdentifier = TEXT
    myIdentifier {
      @import 'EXT:my_extension/Configuration/TypoScript/bar.typoscript'
      value = foo
    }

    ```
