[TYPO3] Wrap content elemts as determined by content writer

Christopher bedlamhotel at gmail.com
Fri Sep 22 20:04:31 CEST 2006


On 9/22/06, Lucas Birk <tlist at birkit.com> wrote:

<big snip to get to original message>

> >> Hello,
> >>
> >> I have a small problem with content classes.
> >> I need to set a different background color, padding etc to different
> >> content elements depending on what they are as determined by a human.
> >> In other words: If the content is an image of a cow make the background
> >> of the div green. If it's a fish, make it blue.
> >> This decision should be determined by the person entering the content
> >> via a selector box because, as far as I am aware, TYPO3 doesn't know the
> >> difference between a cow and fish. They are both just images.
> >> I am stuck with this line of code: renderObj.stdWrap.wrap = <div
> >> class="{$variable}">|</div>
> >> Is it possible to throw a "real" variable in there some how or is my
> >> line of thinking wrong?

I suspect your line of thinking IS wrong. Ever notice the 'Frame'
select box in the content element? Based on your description, it
should probably be all you need. Try the following code and then
change the value of the 'Frame' select box in your content element:

### Add to TSconfig field in 'Edit page properties' form:
###
TCEFORM {
  tt_content {
    section_frame {
      removeItems = 1,5,6,10,11,12,20,21
      addItems.50 = Cow
      addItems.60 = Fish
    }
  }
}

### Add to 'Setup' field of main TS template:
###
tt_content.stdWrap.innerWrap.cObject {
  50 = TEXT
  50 {
    value = <div class="cow">|</div>
  }

  60 = TEXT
  60 {
    value = <div class="fish">|</div>
  }
}


-Christopher



More information about the TYPO3-english mailing list