Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

define Frontend Layouts for page trees

I'm using the field Frontend-Layout at my TYPO3 7.6-Backend. Because my website will have four different departments with different colours in frontend.

pages frontend choose layout

So I'm using:

TCEFORM {
    pages {
        layout {
            altLabels {
                0 =  [ blue]
                1 =  [ orange ]
                2 =  [ green]
                3 =  [ yellow]
            }
        }
    }

} ### TCEFORM

At my FLUIDTEMPLATE I'll wrap an <div>-wrapper, to set my different languages globally at my stylesheet. f.e. div.wrap.blue { background-color:blue;}

<div class="wrap 
{f:if(condition:'{data.layout} == 0',then:'blue')}
{f:if(condition:'{data.layout} == 1',then:'orange')}
{f:if(condition:'{data.layout} == 2',then:'green')}
{f:if(condition:'{data.layout} == 3',then:'yellow')}">
...

This works perfect for me. But how can I slide (or inherit) the frontend-layout-info from my parent-page to the subpages on my pagetree? I don't want to choose the frontend layout in page properties everytime, if I will add a new page into my pagetree. This must be working automatically. Is this possible? With slide?

For example

*ROOT
  + parent blue
    ~~ sub blue 1 /* these pages also have frontend layout 0 */
    ~~ sub blue 2
  + parent orange
    ~~ sub orange 1
  + parent green
    ...
  + parent yellow
  ...

Thebks for your opinion or tips ..

like image 983
user2310852 Avatar asked Oct 27 '25 10:10

user2310852


1 Answers

I don't think it's dead simple to set the {data.layout} layout recursively without manipulating the database. I have three 'solutions' coming to mind to solve your problem:

1) Create four Backend Layouts that you can select for your current and childpages. (Basically rinse and repeat what you have done for your first backend layout)

2) Using your layout modes you could try setting a body class using typoscript like so (i did not test this):

page.bodyTag >
page.bodyTagCObject = TEXT
page.bodyTagCObject.field = data.layout
page.bodyTagCObject.wrap = <body class="color-|"> 

3) Use a similar typoscript but update the value using typoscript conditions such as [pidInRootline]

page.bodyTag >
page.bodyTagCObject = TEXT
page.bodyTagCObject.wrap = <body class="blue">

[PIDinRootline = 1]
page.bodyTagCObject.wrap = <body class="orange">
[global]

[PIDinRootline = 2]
page.bodyTagCObject.wrap = <body class="green">
[global]
# and so on
like image 134
The F Avatar answered Oct 30 '25 14:10

The F



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!