如何在 typo3 中用 div 换行图像?
How to wrap image with div in typo3?
要删除默认环绕图像,我使用了这个模板代码:
tt_content.image.20.rendering.noWraps {
imageRowStdWrap.dataWrap = |
noRowsStdWrap.wrap = |
oneImageStdWrap.dataWrap = |
imgTagStdWrap.wrap = |
editIconsStdWrap.wrap = |
caption.wrap = |
}
# Set this as active rendering method
tt_content.image.20.renderMethod = noWraps
我想在特定部分的代码之上覆盖它。
这是我的代码:
SCREENSHOTS<styles.content.get
SCREENSHOTS.select.where = colPos = 9
SCREENSHOTS.renderObj.dataWrap = <div class="screen">|</div>
没用。怎么做?
根据 documentation for the CONTENT object:
Since in the above example .renderObj is not set explicitly, TYPO3 will automatically set 1.renderObj < tt_content, so that renderObj will reference the TypoScript configuration of tt_content. The according TypoScript configuration will be copied to renderObj.
自从您声明 SCREENSHOTS.renderObj.dataWrap = <div class="screen">|</div>
后,您不会将任何配置自动复制到您的 renderObj
。
如果我理解你的目标是正确的,那么你希望删除所有环绕 'image only' 内容元素并将其全部包裹在一个 div 标记 <div class="screen">|</div>
中。以下内容未经测试,但如果您提供的第一个被阻止的代码适用于所有 'image only' 内容元素,则应该有效。
# Create a new renderMethod named 'noWraps' which can be used across the whole system
tt_content.image.20.rendering.noWraps {
imageRowStdWrap.dataWrap = |
noRowsStdWrap.wrap = |
oneImageStdWrap.dataWrap = |
imgTagStdWrap.wrap = |
editIconsStdWrap.wrap = |
caption.wrap = |
}
SCREENSHOTS < styles.content.get
SCREENSHOTS {
select.where = colPos = 9
renderObj < tt_content
renderObj {
# Set renderMethod to 'noWraps' only for this section
image.20.renderMethod = noWraps
# Change the default wrapping around the content element but only if it's a 'image only' contant element
stdWrap.innerWrap >
stdWrap.innerWrap.cObject = CASE
stdWrap.innerWrap.cObject {
key.field = CType
default < tt_content.stdWrap.innerWrap.cObject
image = TEXT
image.value = <div class="screen">|</div>
}
}
}
如果上面的代码不行就写个评论,我会研究一下。
要删除默认环绕图像,我使用了这个模板代码:
tt_content.image.20.rendering.noWraps {
imageRowStdWrap.dataWrap = |
noRowsStdWrap.wrap = |
oneImageStdWrap.dataWrap = |
imgTagStdWrap.wrap = |
editIconsStdWrap.wrap = |
caption.wrap = |
}
# Set this as active rendering method
tt_content.image.20.renderMethod = noWraps
我想在特定部分的代码之上覆盖它。
这是我的代码:
SCREENSHOTS<styles.content.get
SCREENSHOTS.select.where = colPos = 9
SCREENSHOTS.renderObj.dataWrap = <div class="screen">|</div>
没用。怎么做?
根据 documentation for the CONTENT object:
Since in the above example .renderObj is not set explicitly, TYPO3 will automatically set 1.renderObj < tt_content, so that renderObj will reference the TypoScript configuration of tt_content. The according TypoScript configuration will be copied to renderObj.
自从您声明 SCREENSHOTS.renderObj.dataWrap = <div class="screen">|</div>
后,您不会将任何配置自动复制到您的 renderObj
。
如果我理解你的目标是正确的,那么你希望删除所有环绕 'image only' 内容元素并将其全部包裹在一个 div 标记 <div class="screen">|</div>
中。以下内容未经测试,但如果您提供的第一个被阻止的代码适用于所有 'image only' 内容元素,则应该有效。
# Create a new renderMethod named 'noWraps' which can be used across the whole system
tt_content.image.20.rendering.noWraps {
imageRowStdWrap.dataWrap = |
noRowsStdWrap.wrap = |
oneImageStdWrap.dataWrap = |
imgTagStdWrap.wrap = |
editIconsStdWrap.wrap = |
caption.wrap = |
}
SCREENSHOTS < styles.content.get
SCREENSHOTS {
select.where = colPos = 9
renderObj < tt_content
renderObj {
# Set renderMethod to 'noWraps' only for this section
image.20.renderMethod = noWraps
# Change the default wrapping around the content element but only if it's a 'image only' contant element
stdWrap.innerWrap >
stdWrap.innerWrap.cObject = CASE
stdWrap.innerWrap.cObject {
key.field = CType
default < tt_content.stdWrap.innerWrap.cObject
image = TEXT
image.value = <div class="screen">|</div>
}
}
}
如果上面的代码不行就写个评论,我会研究一下。