[TYPO3] Getting title of parent item in a menu

JoH asenau info at cybercraft.de
Sat Aug 18 00:42:45 CEST 2007


> What I'm trying to achieve is this:
>
> The page tree looks like this:
>
>> --Page1
>>    |--downloads
>>    |--info
>>    \--wiki
>>
>> --Page2
>>    |--downloads
>>    |--info
>>    \--wiki
>>
>
> etc.
>
> Now I want to show a menu with only pages from the 2nd level but
> where the link texts also mention the first level:
>
> I need links to the subpages, but the titles of those subpages don't
> say much. Therefore I need to display the title of the level above:
>
>    <link to info under Page1>Page1:info</link>
>    <link to info under Page2>Page2:info</link>
>    <link to info under Page3>Page3:info</link>
>
> Suggestions welcome!

There are two possible ways to do it, depending on something that I can just
guess:

1. If you want to show the next level for the current page you can use
Daniels approach.
2. If you want to show the whole menu you could do it like this:

temp.whatever = HMENU
temp.whatever {
    wrap = <ul>|</ul>
    entryLevel = 0
    1 = TMENU
    1 {
        expAll = 1
        NO {
            doNotShowLink = 1
            stdWrap.cObject = LOAD_REGISTER
            stdWrap.cObject {
                level1Title = TEXT
                level1Title.field = title
            }
        }
    }
    2 = TMENU
    2 {
        NO {
            allWrap = <li>|</li>
            stdWrap.dataWrap = {register:level1Title}:|title
        }
    }
}

This will put the title of the level1 page into a register called
level1Title and then reuse it for the level2 titles. The level1 titles and
links won't be rendered though. Since level2 will be rendered after each
corresponding level1 title, the register should change accordingly and
always contain the correct level1 title.

Not tested, but should be working.

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
openBC/Xing: http://www.cybercraft.de
T3 cookbook: http://www.typo3experts.com




More information about the TYPO3-english mailing list