我有3张图片(内容对象):
tempProjectImage = IMAGE
tempProjectImage {
file{
#Nur der erste Eintrag.
import.listNum = 0
#Datei wird aus DAM gelesen
import.cObject = USER
import.cObject {
userFunc = tx_dam_tsfe->fetchFileList
refField = project_picture
refTable = tx_nmshowroom_items
}
width = 298
height = 200
}
altText.field = title
titleText.field = title
params = class="previewImage"
}
tempItemImage = IMAGE
tempItemImage {
file{
#Nur der erste Eintrag.
import.listNum = 0
#Datei wird aus DAM gelesen
import.cObject = USER
import.cObject {
userFunc = tx_dam_tsfe->fetchFileList
refField = images
refTable = tx_nmshowroom_items
}
width = 298
height = 200
}
altText.field = title
titleText.field = title
params = class="previewImage"
}
custImage = IMAGE
custImage {
file{
#Nur der erste Eintrag.
import.listNum = 0
#Datei wird aus DAM gelesen
import.cObject = USER
import.cObject = USER
import.cObject {
userFunc = tx_dam_tsfe->fetchFileList
refField = images
refTable = tx_nmshowroom_customers
refUid.field = tx_nmshowroom_customers
}
width = 298
height = 200
}
altText.field = title
titleText.field = title
params = class="previewImage"
}
在我的HTML模板中
###IMAGE###
我想要做的是一种多重覆盖:
如果tempItemImage为空,则显示tempProjectImage,如果tempProjectImage也为空,则显示custImage。
我开始时:
image < .customers.custImage
image.file.import.override.cObject < .tempProjectImage.file.import.cObject
这完美无缺。但是当我添加另一个覆盖:
image < .customers.custImage
image.file.import.override.cObject < .tempProjectImage.file.import.cObject
image.file.import.override.cObject < .tempItemImage.file.import.cObject
它不再起作用了。 tempItemImage(如果存在)永远不会覆盖其他图像。
我做错了什么?
提前致谢, 的Davide
答案 0 :(得分:2)
有一个stdWrap函数“ifEmpty”,我想这适合你想做的事。
(未测试的)
# you need only one IMAGE object,
# but you add an ifEmpty statement, two times with
# the fall back USER-Object
tempProjectImage = IMAGE
tempProjectImage {
file{
import.listNum = 0
import.cObject = USER
import.cObject {
# default
}
import.ifEmpty.cObject = USER
import.ifEmpty.cObject {
# Fallback
}
import.ifEmpty.ifEmpty.cObject = USER
import.ifEmpty.ifEmpty.cObject {
# second fallback
}
}
}