[Typo3] Case / if statements in TMENU for ATagParams

JoH info at cybercraft.de
Wed Apr 13 19:26:52 CEST 2005


>> ATagParams = param1 || 28 times param1 + separator || param1 |*|
>> param2
>>> *|
>>
>> param2 will be repeated but unfortunately you can't repeat two parts
>> of optionSplit a certain times.
>>
>>
>
> Thanks for your answer ..
> but this seems not to generate the requested effect:
> if I right, your solution gives param1 to the first 30 menu items and
> param2 to the rest.

This is what I thought you wanted to achieve ...

> What I want is, that if the menu item has more than 30 characters, I
> want to have param2 loaded, because my menu is 220px wide with more
> than 30 characters, the menuitem will apear in two lines ...
>
> Maybe my (broken) english doesn't point that out in my first mail
> ...;-)

Think so. - So correct me if I'm wrong but now I understand:
You want to insert a linebreak after 30 characters?
Not that easy, since usually you insert linebreaks after a word.
So it might happen that you have to insert it after less than 30 characters.

You will have to count the characters, and if there are more than 30 you
will have to find the last space before number 30 and replace it with a
linebreak.
Sounds like a job for a PHP function or maybe TS "split" to me.
TMENUITEM has stdWrap properties, so you you should be able to use something
like this:

Using a PHP function will work like this (assuming you included the PHP file
before):

NO {
    stdWrap.preUserFunc = user_function
}

Split will be a semiautomatic approach. You fill in a split Character for
each title (in this case it's #) and the menu will be rendered with a break
for each #:

NO {
    stdWrap.split {
        token = #
        cObjNum = |*|1|*|2
        1.current = 1
        1.wrap = |<br />
        2.current = 1
    }
}

Not tested but should be working

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.openbc.com/go/invuid/Jo_Hasenau





More information about the TYPO3-english mailing list