[TYPO3] Section index and option split

JoH asenau info at cybercraft.de
Mon May 14 20:25:02 CEST 2007


>>>>> sorry I was wrong, not Joey but Bernhard...  It was probably
>>>>> kb_betterstdwrap that I'm thinking of.
>>>> ok Endeed I would be delighted if I could get some advice how to
>>>> do that using CASE/if and LOAD_REGISTER
>>>
>>> You don't need them at all.
>>> Use split instead, which will give you the optionSplit you wanted.
>>> All you have to do is create a "splitter" in the output of your
>>> CONTENT element.
>>> Don't remember when I posted this the first time so here is a small
>>> example
>>> similar to the one we are using in the cookbook:
>>>
>>> 10 = COA
>>> 10 {
>>>     10 = CONTENT
>>>     10 {
>>>         table = blah
>>>         select {
>>>             #blah
>>>         }
>>>         renderObj = COA
>>>         renderObj {
>>>             # blah
>>>             wrap = |###SPLITTER###
>>>         }
>>>     }
>>>     stdWrap.split {
>>>         token = ###SPLITTER###
>>>         cObjNum = 1 || 2 |*| 3 || 4 |*| 5 || 6
>>>         1.current = 1
>>>         1.wrap = <div class="wrap1">|</div>
>>>         2.current = 1
>>>         2.wrap = <div class="wrap2">|</div>
>>>         3.current = 1
>>>         3.wrap = <div class="wrap3">|</div>
>>>         4.current = 1
>>>         4.wrap = <div class="wrap4">|</div>
>>>         5.current = 1
>>>         5.wrap = <div class="wrap5">|</div>
>>>         6.current = 1
>>>     }
>>> }
>>>
>>> This will wrap ten entries like this:
>>>
>>> wrap1, wrap2, wrap3, wrap4, wrap3, wrap4, wrap3, wrap4, wrap3, wrap5
>
> I don't understand the result (in the middle 'wrap3, wrap4') .

optionSplit works like this:

first |*| middle |*| last

where middle will be rotated while first and last will only be partly
repeated.
So the given example rotates the middle part wrap3, wrap4 until the last
part is rendered.

> In
> fact I would need just first, middle, last - what could be the
> minimum wrap set?

you can start with this code

10 = COA
10 {
    10 = CONTENT
    10 {
        table = blah
        select {
            #blah
        }
        renderObj = COA
        renderObj {
            # blah
            wrap = |###SPLITTER###
        }
    }
    stdWrap.split {
        token = ###SPLITTER###
        cObjNum = 1|*||*|2
        1.current = 1
        1.wrap = <div class="wrap1">|</div>
        2.current = 1
    }
}

But then you would just get one wrap and therefor the whole split section
would be unnecessary. So the first one that makes sense is this:

    stdWrap.split {
        token = ###SPLITTER###
        cObjNum = 1|*||*|2||3
        1.current = 1
        1.wrap = <div class="wrap1">|</div>
        2.current = 1
        2.wrap = <div class="wrap2">|</div>
        3.current = 1
    }

and for a working combination of first, default, last it would be


    stdWrap.split {
        token = ###SPLITTER###
        cObjNum = 1||2|*||*|3||4
        1.current = 1
        1.wrap = <div class="wrapfirst">|</div>
        2.current = 1
        2.wrap = <div class="wrapmiddle">|</div>
        3.current = 1
        3.wrap = <div class="wraplast">|</div>
        4.current = 1
    }

Remember the last element in the wrap section will always be empty since the
string parsed by the split function looks like this:

SOME CONTENT
###SPLITTER###
SOME CONTENT
###SPLITTER###
SOME CONTENT
###SPLITTER###
SOME CONTENT
###SPLITTER###

There is nothing after the last ###SPLITTER### so the last element that can
be wrapped in fact is the last but one. This is the only difference to the
optionSplit used in a real menu.

Got the point?

Joey

-- 
Wenn man keine Ahnung hat: Einfach mal Fresse halten!
(If you have no clues: simply shut your gob sometimes!)
Dieter Nuhr, German comedian
openBC/Xing: http://www.cybercraft.de
T3 cookbook: http://www.typo3experts.com




More information about the TYPO3-english mailing list