typo3typoscripttypo3-7.6.x

How to use Typoscript conditions for page uid?


How do I use conditions to put different headerdata on the home page and 3 other pages using typoscript?

I have tried this:

page {
    [treeLevel = 0]
      headerData.20.value = Home Page
    [END]
    [page|uid = 1]
      headerData.20.value = Page 1
    [END]
    [page|uid = 2]
      headerData.20.value = Page 2
    [END]
    [page|uid = 3]
      headerData.20.value = Page 3
    [END]
}

But the home page outputs Page 3

I have also tried [globalVar = TSFE:id = X] with the same result.

And the object Browser says [ is an invalid character?


Solution

  • According to documentation (thanks to @BerndWilkeπφ for reminding), TypoScript conditions must be placed on top level of your TS (outside of any other structures).

    Not in any cObject like page, neither within other conditions.