I want to know what the layout of the parent page is in my fluid template.
So in the template I've added:
<f:cObject typoscriptObjectPath="lib.parentLayout" data="{uid: {data.pid}}" />
But I am not sure what to do in typoscript:
lib.parentLayout = CONTENT
lib.parentLayout {
table = pages
select {
uid.data = field:uid
fieldName = layout
}
}
There are different options to get that information.
You could for example add the field layout to the so called rootline fields
https://docs.typo3.org/m/typo3/reference-coreapi/main/en-us/Configuration/Typo3ConfVars/FE.html#globals-typo3-conf-vars-fe-addrootlinefields and make use of the level functionality of getText:
lib.parentLayout = TEXT
lib.parentLayout {
data = levelfield:-2, layout
}
or you could use the PID (aka parent parent ID) to get the parent page with CONTENT:
lib.parentLayout = CONTENT
lib.parentLayout {
table = pages
select {
uidInList.field = pid
pidInList = 0
selectFields = layout
}
renderObj = TEXT
renderObj.field = layout
}
or with RECORDS:
lib.parentLayout = RECORDS
lib.parentLayout {
tables = pages
source.field = pid
conf.pages = TEXT
conf.pages {
field = layout
}
}
and of course you can go for setting UID with PID in the Fluid template, but IMHO this is misleading.