[Typo3] manipulate contentelements by TS

JoH info at cybercraft.de
Mon Nov 14 16:08:17 CET 2005


>> "you want for each and every "Text w/image" and "image" element or
>> if it is just used for special cases."
>>
>> Thats why I wanted to do the thing by an extension template for one
>> special page, where thet template would work for the special page and
>> all subpages.
>>
>> To answer your question, I want it to work just on special pages
>> *not* global for all the sites.
>
> Only for special pages and only for text with image!
> Thanks!
>   =)

OK - basically it's just emptying the original setup and then creating your
own instead.
But then again it's a bit tricky since we will be using the TS-Element TEXT
to get the images out of the "image" field.

tt_content.textpic.20 >
tt_content.textpic.20 = COA
tt_content.textpic.20 {
  10 = TEXT
  10 {

      ### get the content of the field image
      field = image

      split {

      ### split it up by "," and render each part separately
        token = ,

        cObjNum = 1
        1 = COA
        1 {

            ### wrap the image+caption block
            wrap = <div class="border">|</div>

            10 = IMG_RESOURCE
            10 {

                ### wrap the image
                stdWrap.wrap = <img src="|" class="img" />

                file {

                    ### get the single image
                    import = uploads/pics/
                    import.current = 1

                    ### scale it and keep proportion
                    width.field = imagewidth

                    ### only if imagewidth is set
                    width.required = 1
                    width.wrap = |m

                    height.field = imageheight
                    ### only if imageheight is set
                    height.required = 1
                    height.wrap = |m
                }
            }
            20 = TEXT
            20 {

                ### wrap the caption
                wrap = <div class="imgcap">|</div>

                ### get the caption
                field = imagecaption
                listNum.splitChar = 13

                ### from the same position in the list as the image
                listNum.stdWrap.data = register:SPLIT_COUNT
            }
        }
      }
  }
  ### get the text and treat it like default text elements
  20 < tt_content.text.20
}

Tested and working ...
Have fun with it.

Joey

-- 
Wenn man keine Ahnung hat: Einfach mal Fresse halten!
(If you have no clues: simply shut your knob sometimes!)
Dieter Nuhr, German comedian
openBC: http://www.openbc.com/go/invuid/Jo_Hasenau





More information about the TYPO3-english mailing list