[TYPO3-english] odd / even classes for every second record

JoH asenau info at cybercraft.de
Tue Jan 12 16:54:42 CET 2010


>>> Just and idea for another means of doing it -as we know that all the
>>> odd and even item will have predefined numbers you could just do
>>> this
> [...]
>> And another one, that is using optionSplit for the same purpose:
>
> anyone in to do a performance comparison of the three approches
> (1,3,5,10,20 elements)?
>
> I'd really like to know. ;)
>
> JoH's approach seems to be the nicest one to me but I am not sure how
> it affects performance.

Then you might want to test another one, that works with even and odd only
(but is still extendable to loop over more than 2 elements):

temp.blah = CONTENT
temp.blah {
    table = tt_content
    select {
        where = colPos = 2
        orderBy = sorting
    }
    renderObj = tt_content
    renderObj {
        stdWrap.outerWrap.cObject = CASE
        stdWrap.outerWrap.cObject {
            key.stdWrap.dataWrap = {cObj:parentRecordNumber}%2
            key.prioriCalc = 1
            default = TEXT
            default.value = <div class="even">|</div>
            1 = TEXT
            1.value = <div class="odd">|</div>
        }
    }
}

Cheers

Joey

-- 
Wenn man keine Ahnung hat: Einfach mal Fresse halten!
(If you have no clues: simply shut your gob sometimes!)
Dieter Nuhr, German comedian
Xing: http://contact.cybercraft.de
Twitter: http://twitter.com/bunnyfield
TYPO3 cookbook (2nd edition): http://www.typo3experts.com




More information about the TYPO3-english mailing list