如何在自定义typo3网格元素中呈现内容?

时间:2013-08-15 16:48:51

标签: grid typo3 elements typoscript

我正在尝试创建一个简单的2列前导元素,在左列显示图像,在右列显示内容元素,再添加按钮链接。

这是原始的ts,它有效,但它很难看,而且图像是静态的:


tt_content.gridelements_pi1.20.10.setup {
        29 < lib.gridelements.defaultGridSetup
        29 {
        columns {
            20 < .default
            20.outerWrap = <div class="fifty1"><div class="csc-textpic csc-textpic-intext-left-nowrap"><div class="csc-textpic-imagewrap"><a href="index.php?id={field:flexform_link1}"><img src="{field:flexform_teaserimage1}" alt="" /></a></div></div><div class="fiftycontent"><div class="csc-textpic csc-textpic-text"><a href="index.php?id={field:flexform_link1}">|</a></div></div><div class="fiftylink"><a href="index.php?id={field:flexform_link1}"><img src="{$tmplpath}images/button.png" alt="" /></a></div></div>
                    20.insertData = 1 
                }
        }

}

这是我编码的新词,图片&amp;按钮有效,但内容元素部分未正确显示:


tt_content.gridelements_pi1.20.10.setup {
        29 < lib.gridelements.defaultGridSetup
        29 {
        columns {
            20.prepend = COA
            20.prepend.20 = IMAGE
            20.prepend.20.file.import.field = flexform_teaserimage1
            20.insertData = 1           
                    20.prepend.20.stdWrap.typolink.parameter.field = flexform_link1
                    20.prepend.20.wrap  = <div class="csc-textpic csc-textpic-intext-left-nowrap"><div class="csc-textpic-imagewrap">|</div></div>

                    20.prepend.25 < .default 

                    20.prepend.25.outerWrap = <div class="fiftycontent"><div class="csc-textpic csc-textpic-text">|</div></div>
                    20.prepend.25.stdWrap.typolink.parameter.field = flexform_link1
            20.prepend.30 = IMAGE
            20.prepend.30.file = {$tmplpath}images/button.png
            20.prepend.30.stdWrap.typolink.parameter.field = flexform_link1
            20.prepend.30.wrap = <div class="fiftylink">|</div> 
            20.prepend.wrap = <div class="fifty1">|</div>

        }
        wrap = <div class="largeteaser">|</div>
        }

}

基本上我只想要“20.prepend.25&lt; .default”工作,我试过“&lt; tt_content”或 “&lt; lib.gridelements.defaultGridSetup.columns.default”,结果有时很奇怪并且重复了很多内容。如何获得与添加“&lt; .default”相同的行为?

1 个答案:

答案 0 :(得分:1)

我明白了,我不确定这是否是最优雅的解决方案但是我使用了prepend / append将renderObj夹在中间

        columns {
        20.outerWrap = <div class="fifty1">|</div>
        20.prepend = COA            
                    20.prepend {
                         20 = IMAGE
                         20.file.width = 386
                         20.file.height = 162 
             20.file.import.field = flexform_teaserimage1
                         20.stdWrap.typolink.parameter.field = flexform_link1
                         20.wrap  = <div class="csc-textpic csc-textpic-intext-left-nowrap"><div class="csc-textpic-imagewrap">|</div></div>
                    }

                    20.renderObj = COA
                    20.renderObj {
                         25 =< tt_content
                         wrap = <div class="fiftycontent"><div class="csc-textpic csc-textpic-text">|</div></div>
                         25.stdWrap.typolink.parameter.field = flexform_link1 
                    }

        20.append = COA         
                    20.append {
             30 = IMAGE
             30.file = {$tmplpath}images/button.png
             30.stdWrap.typolink.parameter.field = flexform_link1
             30.wrap = <div class="fiftylink">|</div> 
                    }

    }