arderoma
arderoma

Reputation: 427

Condition for backend layout name in Typo3 10+

I'm looking for a way to render a partial for when an element is placed it on a part of the backend layout and another partial for when the same element is placed it on another part of the backend layout.

My backend layout names are "Header" on top and "Normal" on the bottom. I want to render text-media element with one partial for when is on Header and another partial for when is on Normal.

For what I could find online seems that this must be done with typoscript. Particualrly I want to use typoscript condition because is the one that make more sense on my head.

I'm aware of this but the answers are not helping me at all.

This is the one that looks like something I could use.

[page["backend_layout"] == 'pagets__2']

    page.bodyTagCObject.value.wrap = <body id="uid|" class="fullpage">

[end]

Any help is welcome even tutorials because clearly I have much to learn about typoscripting

Upvotes: 1

Views: 636

Answers (2)

Julian Hofmann
Julian Hofmann

Reputation: 2592

You can pass the needed value as a variable to your FLUIDTEMPLATE-object.

The current backend-layout is available as pagelayout (Already with the 'backend_layout_next_level' taken into account).

page.10 = FLUIDTEMPLATE
page.10 {
  variables {
    pagelayout = TEXT
    pagelayout.data = pagelayout
  }

}

Upvotes: 1

arderoma
arderoma

Reputation: 427

Solved it.

I have been able to solve this problem without useing Typoscript. (so I will keep ignoring typoscript :D )

Dropping the variables of the loaded templates (not partials) made me realized that there was a property holding the colPos of the backend layout so all I had to do was an if condition on the textmedia default template.

<f:if condition="{data.colPos} == 1">
  If the colPos of the backend layout is 1 print something
</f:if>

Upvotes: 0

Related Questions