1

我有 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(如果存在)永远不会覆盖其他图像。

我究竟做错了什么?

在此先感谢,戴维德

4

1 回答 1

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
    }
  }
}
于 2012-10-30T16:14:06.817 回答