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

JoH asenau info at cybercraft.de
Tue Jan 12 13:39:53 CET 2010


>>     stdWrap.split {
>>         token = ###SPLITTER###
>>         cObjNum = 1 |*| 2 || 3 |*| 4 || 5
>>         1.current = 1
>>         1.wrap = <div class="first">|</div>
>>         2.current = 1
>>         2.wrap = <div class="even">|</div>
>>         3.current = 1
>>         3.wrap = <div class="odd">|</div>
>>         4.current = 1
>>         4.wrap = <div class="last">|</div>
>>         5.current = 1
>>     }
>> }
>
>
> This is probably the best way of doing it IMO. Thanks for posting this
> Joey - I was looking for an example like this the other day and
> couldn't find one. I know there is a reason for having 5.current=1
> but I can't remember why it's there. Can you please explain it
> briefly.

The 5 is needed because the COA ends with ###SPLITTER### before the split
function will divide it.
This will result in an empty element as last element "behind" the
###SPLITTER###.
To prevent this element from being wrapped by <div class="last">|</div> you
need an empty last element without any wrap.

HTH

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