将TypoScript更改为一条记录

时间:2014-11-28 00:16:00

标签: typo3 typoscript

有人可以帮我使用TypoScript吗?

谷歌和SO没有给我这个问题的线索。

我有以下情况。 我正在使用fluid模板和TS从每个页面的一个来源获取一个内容项。

lib.footer_video_content = RECORDS
lib.footer_video_content {
    tables = tt_content
    source = 11
}

内容元素是图像列表(textpic类型)。

代码工作正常。它抓住元素很好,但我不知道如何为仅一个元素应用不同的布局

我可能会关注全局模板设置

tt_content.image.20 {
    imageStdWrap.dataWrap = ...
    imageStdWrapNoWidth.wrap = ...
    #... etc
}

但这会改变页面上每个元素的包装。

任何帮助都会很棒,谢谢。

2 个答案:

答案 0 :(得分:3)

使用CONTENT内容对象而不是RECORDS内容对象,然后使用renderObj属性呈现内容元素。

lib.footer_video_content = CONTENT
lib.footer_video_content {
    table = tt_content
    select {
        uidInList = 11
        pidInList = <Page ID where the content element is>

        languageField = sys_language_uid

        # Add more settings if needed
    }

    # This renderObj just renders the header of the content element
    # You could also copy the rendering definition from tt_content and
    # modify it, e.g.
    #   renderObj < tt_content
    #   renderObj.image.20 {
    #     imageStdWrap.dataWrap = ...
    #   }
    renderObj = TEXT
    renderObj {
        data.field = header
    }
}

答案 1 :(得分:1)

我使用自定义div包装器(框架)进行此操作:

tt_content.stdWrap.innerWrap.cObject = CASE
tt_content.stdWrap.innerWrap.cObject {

  key.field = section_frame

  # Delete standard wraps

  1 >
  5 >
  6 >
  10 >
  11 >
  12 >
  20 >
  21 >

  # Define new wraps

  101 >
  101 = TEXT
  101.value = <div id="yourwrap">|</div>
}

TCEFORM.tt_content.section_frame {

  removeItems = 1,2,3,4,5,6,7,8,9,10,11,12,20,21

  addItems.101 = My new wrap

}

现在,您可以在contentelement的选择框中选择包装器(框架) 看这里:http://www.digiblog.de/2010/10/custom-frames-for-typo3-content-elements/

现在你可以在css中设置这个元素的样式!