根据条件在包装文字中添加包装器div

时间:2019-05-21 13:26:10

标签: typoscript typo3-8.x

我正在使用typo3 9.5版本。我需要在打字稿中的打字稿中包含来自页面内容的媒体字段。另外,我正在获取图像。但是我不知道该如何渲染(以情况为准)。如何在该打字稿中呈现媒体字段?我把打字稿写成

lib.onepageWrapperContent = COA
lib.onepageWrapperContent {

20 = CONTENT
20 {
    table = pages
    select.orderBy = sorting

    renderObj = COA
    renderObj {
        10 = CONTENT
        10 {
            table = tt_content
            select {
                pidInList.field = uid
                orderBy = sorting
                where = colPos = 0
            }


            stdWrap.wrap {
                cObject = CASE 
                cObject {
                    key.field  = layout

                    1 = COA
                    1 {
                        10 = FILES
                        10 {
                        #1
                            references {
                                table = tt_content
                                uid.data = field:uid
                                fieldName = image
                            }
                            renderObj = COA
                            renderObj {
                                #2
                                10 = IMG_RESOURCE
                                10{
                                    file{
                                    import.data = file:current:originalUid // file:current:uid
                                    altText.data = file:current:description
                                    titleText.data = file:current:title
                                    }
                                #3
                                stdWrap.wrap = <div style="background-image:url('/|');"></div>
                                }
                            }
                        }
                        1.stdWrap.wrap = <section id="{field:uid}" class="section" data-anchor="{field:title}"><div class="bg-element">|</div></section>
                        1.insertData = 1
                    }


                    2 = COA
                    2 {
                        20 = FILES
                        20 {
                        #1
                            references {
                                table = tt_content
                                uid.data = field:uid
                                fieldName = image
                            }
                            renderObj = COA
                            renderObj {
                                #2
                                10 = IMG_RESOURCE
                                10{
                                    file{
                                    import.data = file:current:originalUid // file:current:uid
                                    altText.data = file:current:description
                                    titleText.data = file:current:title
                                    }
                                #3
                                stdWrap.wrap = <div style="background-image:url('/|');"><div class="overlay"></div></div>
                                }
                            }
                        }
                        2.stdWrap.wrap = <section id="{field:uid}" class="section" data-anchor="{field:title}"><div class="bg-element">|</div></section>
                        2.insertData = 1
                    }



                    default = TEXT
                    default.value =  <section id="{field:uid}" class="section" data-anchor="{field:title}"><div class="bg-element">|</div></section>
                    default.insertData = 1

                }
            }
        }

    }

    wrap = <div id="fullpage">|</div>
}

}

我需要的输出是

<section class="section"><div class="bg-element" style="background-image: url(../img/1.png)"></div></section>

但是我没有正确获得包装纸。有人可以帮忙吗?

0 个答案:

没有答案