[TYPO3] Getting title of parent item in a menu

JoH asenau info at cybercraft.de
Sun Aug 19 17:32:49 CEST 2007


> I needed the allStdWrap to be able to hide the unwanted items
> entirely, but because of that now only the words downloads/info/wiki
> are linked, not the entire line including {register:level1Title}. I
> tried to achieve that but didn't succeed. Anyway, it's acceptable
> like it is now.

2 = TMENU
2.NO {
    allStdWrap {
        # Show only if current-page-id and menu-item-parent_id match
        if {
            value.data = TSFE:id
            equals.field = pid
        }
    }
    stdWrap {
        # Put the register content before the linktext
        dataWrap = {register:level1Title}: |
    }
    # Wrap the item
    allWrap = <li>|</li>
}

> Interesting enough I found out that
> currentpagetitle.cObject.data = page:title
> behaves differently then
> currentpagetitle.cObject.field = title
> The first one takes the title of the current page (always), the
> second - when used in a menu like this one - returns the last title
> of the last item of that level.

This is the way it is meant to be since page:whatever always contains data
from the current page record itself, while field=title uses another "focus"
when used inside an HMENU and will be containing data from the page record
currently rendered in the menu.

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