TYPO3:如何创建将由子页面继承的标题图像

TYPO3:如何创建将由子页面继承的标题图像,typo3,typoscript,Typo3,Typoscript,我必须按照以下要求为标题图像设置打字脚本配置: lib.fallBackHeaderImage = IMAGE lib.fallBackHeaderImage { file { import.cObject = TEXT import.cObject.value = {$portal.context.headerImage.filename} maxW = 1124 maxH = 342 } } lib.heade

我必须按照以下要求为标题图像设置打字脚本配置:

lib.fallBackHeaderImage = IMAGE
lib.fallBackHeaderImage {
    file {
        import.cObject = TEXT
        import.cObject.value = {$portal.context.headerImage.filename}
        maxW = 1124
        maxH = 342
    }
}

lib.headerImage = IMAGE
lib.headerImage {
    file {
        import {
            data = levelmedia:-1, slide
            listNum = 0
        }
        treatIdAsReference = 1
        maxW = 1124
        maxH = 342
    }
}

lib.headerContent < styles.content.getLeft
lib.headerContent {
    renderObj < tt_content
    renderObj {
        image >
        image = FILES
        image {
            references {
                table = tt_content
                fieldName = image
                uid.data = uid
            }
            renderObj = IMAGE
            renderObj {
                file {
                    import.data = file:current:originalUid // file:current:uid
                    maxW = 1124
                    maxH = 342
                }
            }
        }
        textpic >
        textpic < .image
    }
}

lib.pageHeader = COA
lib.pageHeader {
    // 10 reserved for prepend content
    20 = COA
    20 {
        10 = COA
        10 {
            10 < lib.fallBackHeaderImage
            stdWrap {
                override {
                    required = 1
                    cObject < lib.headerImage
                }
            }
        }
        stdWrap {
            override {
                required = 1
                cObject < lib.headerContent
            }
        }
    }
    // 30 reserved for appended content
}
编辑器应该能够使用“编辑页面属性->资源->媒体”对话框为页面定义标题图像。如果页面没有页眉图像,则应扫描父页面的页眉图像,并使用在页面树根上找到的第一个页眉图像

编辑器还应该能够将内容元素添加到特定的“页眉”部分。此内容元素可以是滑块/菜单或图像。如果添加了类型为“image”或“text with image”的内容元素,则只应呈现图像本身,而不应呈现其他附加代码。添加到页眉部分的内容元素应具有优先级。因此,如果一个页面在页眉部分包含一个内容元素,并且在resources->media字段中也有一个图像,则该页面的media字段中的图像或页面树中更高级别的任何其他页面中的图像将被忽略,并且呈现页眉部分中的内容元素/图像


回退:如果页面标题部分没有内容,并且在页面的媒体字段或其根行中的其他页面中也找不到图像,则应呈现通过打字脚本常量定义的默认图像,以防止标题部分留空。

此打字脚本使用覆盖,幻灯片和嵌套COA对象,以满足给定要求的方式渲染标题图像:

lib.fallBackHeaderImage = IMAGE
lib.fallBackHeaderImage {
    file {
        import.cObject = TEXT
        import.cObject.value = {$portal.context.headerImage.filename}
        maxW = 1124
        maxH = 342
    }
}

lib.headerImage = IMAGE
lib.headerImage {
    file {
        import {
            data = levelmedia:-1, slide
            listNum = 0
        }
        treatIdAsReference = 1
        maxW = 1124
        maxH = 342
    }
}

lib.headerContent < styles.content.getLeft
lib.headerContent {
    renderObj < tt_content
    renderObj {
        image >
        image = FILES
        image {
            references {
                table = tt_content
                fieldName = image
                uid.data = uid
            }
            renderObj = IMAGE
            renderObj {
                file {
                    import.data = file:current:originalUid // file:current:uid
                    maxW = 1124
                    maxH = 342
                }
            }
        }
        textpic >
        textpic < .image
    }
}

lib.pageHeader = COA
lib.pageHeader {
    // 10 reserved for prepend content
    20 = COA
    20 {
        10 = COA
        10 {
            10 < lib.fallBackHeaderImage
            stdWrap {
                override {
                    required = 1
                    cObject < lib.headerImage
                }
            }
        }
        stdWrap {
            override {
                required = 1
                cObject < lib.headerContent
            }
        }
    }
    // 30 reserved for appended content
}
lib.fallBackHeaderImage=IMAGE
lib.fallBackHeaderImage{
文件{
import.cObject=TEXT
import.cObject.value={$portal.context.headerImage.filename}
最大值=1124
最大值=342
}
}
lib.headerImage=图像
lib.headerImage{
文件{
进口{
data=levelmedia:-1,幻灯片
listNum=0
}
治疗参考=1
最大值=1124
最大值=342
}
}
lib.headerContent
图像=文件
形象{
参考资料{
表=tt_含量
字段名=图像
uid.data=uid
}
renderObj=图像
伦德罗布{
文件{
import.data=file:current:originalUid//file:current:uid
最大值=1124
最大值=342
}
}
}
textpic>
textpic<.image
}
}
lib.pageHeader=COA
lib.pageHeader{
//10预留用于前置内容
20=COA
20 {
10=COA
10 {
10