[TYPO3] wrapping content elements

JoH info at cybercraft.de
Sat Mar 18 17:42:54 CET 2006


> I tried to wrap every second content element in typo3 like this:
>
> 10.marks.CONTENT.renderObj.stdWrap.wrap=<div
> style="background-color:#000000;">|</div>|*|<div
> style="background-color:#d3d3d3;">|</div>
>
> But this did not work.
>
> Does anyone have an idea how I can manage to wrap every second content
> element different?!?

Try this one:

tt_content.stdWrap.outerWrap.cObject = COA
tt_content.stdWrap.outerWrap.cObject {
  10 = LOAD_REGISTER
  10 {
    normalValue.cObject = TEXT
    normalValue.cObject.dataWrap = {cObj:parentRecordNumber}/2
    normalValue.prioriCalc = 1
    intValue.cObject = TEXT
    intValue.cObject.dataWrap = {cObj:parentRecordNumber}/2
    intValue.prioriCalc = intval
    isEven.cObject = TEXT
    isEven.cObject.value = 1
    isEven.cObject.if.value.data = register:normalValue
    isEven.cObject.if.equals.data = register:intValue
  }
  20 = TEXT
  20.value = |
  20.dataWrap = <div style="border:1px solid red;">|</div>
  20.if.isTrue.data = register:isEven
  30 = TEXT
  30.value = |
  30.dataWrap = <div style="border:1px solid blue;">|</div>
  30.if.isFalse.data = register:isEven
}

The LOAD_REGISTER uses the record counter provided by
cObj:parentRecordNumber and calculates, if it is even or odd.
Then you have two different TEXT Elements, checking if even is set or not to
swap them accordingly.

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.cybercraft.de





More information about the TYPO3-english mailing list