Multiple Images in one TemplaVoilà field


/ Published in: TYPO3
Save to your folder(s)

The snippet is splitted in two parts. One in the main template and one in the Templavoila DataStructure XML field. In the TypoScript part the value of the TV field is splitted by "," and the cObj 1 is adapted to the current value. you could also use split options like 1 |*| 2 |*| 3. In this case the first image will be processed in cObj 1 the last in cObj 3 and all images between in cObj 2.

The only limit how much images you can use is the limit in the TV DS, in this expamle is set the to 5 and to 15.


Copy this code and paste it in your HTML
  1. #####################################################
  2. ## Typoscript in the main template
  3. #####################################################
  4. temp.content_Img = COA
  5. temp.content_Img {
  6. 10 = HTML
  7. 10 {
  8. value.field = field_img #name des feldes im tv xml
  9. value.split {
  10. token = ,
  11. cObjNum = 1
  12. 1 {
  13. 10 = IMAGE
  14. 10 {
  15. file {
  16. import.current = 1
  17. import = uploads/tx_templavoila/
  18. format = jpg
  19. width = 245c
  20. height = 155c
  21. }
  22. }
  23. }
  24. }
  25. }
  26. }
  27. lib.contentImgNorm = COA
  28. lib.contentImgNorm {
  29. 10 < temp.content_Img
  30. }
  31.  
  32. #####################################################
  33. ## adjustments in the TemplaVoil�  DataStructure XML
  34. #####################################################
  35. <?xml version="1.0" encoding="utf-8" standalone="yes" ?>
  36. <T3DataStructure>
  37. <meta type="array">
  38. <langDisable>1</langDisable>
  39. </meta>
  40. <ROOT type="array">
  41. <tx_templavoila type="array">
  42. <title>ROOT</title>
  43. <description>Multiple Images</description>
  44. </tx_templavoila>
  45. <type>array</type>
  46. <el type="array">
  47. <field_img type="array">
  48. <tx_templavoila type="array">
  49. <title>Bilder</title>
  50. <sample_data type="array">
  51. <numIndex index="0"></numIndex>
  52. </sample_data>
  53. <eType>imagefixed</eType>
  54. <tags>*:inner</tags>
  55. <TypoScriptObjPath>lib.contentImgNorm</TypoScriptObjPath>
  56. </tx_templavoila>
  57. <TCEforms type="array">
  58. <config type="array">
  59. <type>group</type>
  60. <internal_type>file</internal_type>
  61. <allowed>gif,png,jpg,jpeg</allowed>
  62. <max_size>1000</max_size>
  63. <uploadfolder>uploads/tx_templavoila</uploadfolder>
  64. <show_thumbs>1</show_thumbs>
  65. <size>5</size>
  66. <maxitems>15</maxitems>
  67. <minitems>0</minitems>
  68. </config>
  69. <label>Bilder</label>
  70. </TCEforms>
  71. </field_img>
  72. </el>
  73. </ROOT>
  74. </T3DataStructure>

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.