我正在使用这个小片段作为滑块:
table = tt_content
select {
where = colPos = 0
orderBy = sorting
languageField = sys_language_uid
}
renderObj = FILES
renderObj {
references {
table = tt_content
fieldName = image
}
renderObj = IMAGE
renderObj {
file.import.data = file:current:publicUrl
stdWrap.typolink.parameter.data = file:current:link
stdWrap.wrap = <li>|</li>
}
}
效果很好,我喜欢它,除了我发现的更复杂的代码之外,它非常紧凑。
我现在想添加imagecaption字段来显示幻灯片中的文本,但无法使其正常工作。
有人对此有暗示吗?
答案 0 :(得分:2)
这取决于滑块想要从中获取标题的位置。如果它可以从图像的标题或alt标签中获取,您只需将标题添加到renderObj:
renderObj = IMAGE
renderObj {
file.import.data = file:current:publicUrl
titleText = file:current:caption
stdWrap.typolink.parameter.data = file:current:link
stdWrap.wrap = <li>|</li>
}
或
renderObj = IMAGE
renderObj {
file.import.data = file:current:publicUrl
altText = file:current:caption
stdWrap.typolink.parameter.data = file:current:link
stdWrap.wrap = <li>|</li>
}
如果您需要将其放在自己的标签内,您应该按照Urs的建议采用COA方法:
renderObj = COA
renderObj {
10 = IMAGE
10 {
file.import.data = file:current:publicUrl
stdWrap.typolink.parameter.data = file:current:link
}
20 = TEXT
20 {
data = file:current:caption
wrap = <span class="imagecaption">|</span>
}
wrap = <li>|</li>
}
答案 1 :(得分:0)
fieldname只是不是标题,而是描述: 文件:电流:描述