简体   繁体   中英

Multiple Images in TemplaVoila Template, TYPO3 6+

You can find many snippets online for the DataStructure of a TemplaVoila FCE, to let it render multiple images in one field. This doesn't work on TYPO3 6+. The whole object just doesn't pop up, but TemplaVoila is also not throwing an error.

The Typoscript of the DS looks like this:

10 = COA
10 {
  10 = HTML
  10 {
    value.field = field_carousel
    value.split {
      token = ,
      cObjNum = 1
      1 {
        10 = IMAGE
        10 {
          file {
            import.current = 1
            import = uploads/tx_templavoila/
            maxW = 1920
          }
        }
      }
    }
  }
}

The field-name is correct. As you can see here: https://snipt.net/mawe/f/ it works actually on TYPO3 4.7.x. Though, on 6+ it seems to break something. The output remains blank. The field-type is image (I tried it with fixed width/height and without). If I keep the original TypoScript, it just shows the first image in my list, which is the correct behaviour:

10 = IMAGE
10 {
    file {
        import = uploads/tx_templavoila/
        import.current = 1
        import.listNum = 1
        maxW = 1920 
    }
}

Anyone knows, how to solve this problem? The final result has to be something like this (I need to wrap it into those div containers as well):

<div class="item">
 <img src"..." alt="" title="" />
</div>
<div class="item">
 <img src"..." alt="" title="" />
</div>
...

cObj HTML is deprecated: TYPO3 lib HTML and TEXT code

So simply change your code to:

10 = COA
10 {
  10 = TEXT
  10 {
    value.field = field_carousel
    value.split {
      token = ,
      cObjNum = 1
      1 {
        10 = IMAGE
        10 {
          file {
            import.current = 1
            import = uploads/tx_templavoila/
            maxW = 1920
          }
        }
      }
    }
  }
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM