Van Coding
Van Coding

Reputation: 24554

hide page & subpages from menu

I have the following page structure in TYPO3:

- 1
  - 2
  - 3
- 4
  - 5
  - 6
- 7
  - 8
  - 9

Now I want to have 1/* + 4/* included in the header menu and 4/* + 7/* in the footer menu. Since the header and footer menus are different, I cannot just use the "hide in menu" feature and need to do it in TypoScript instead.

Here's what I have so far:

HEADERMENU = HMENU
HEADERMENU {
    1 = TMENU
    1.expAll = 1

    1.NO = 1
    1.NO {
        stdWrap.if.value.field = uid
        stdWrap.if.equals = 7
        stdWrap.if.negate = 1
    }

    2 < .1
}

FOOTERMENU < HEADERMENU
FOOTERMENU.1.NO.stdWrap.if.equals = 1

The problem with this is, that it still displays the pages 8+9 in the header and 2+3 in the footer, even if it does not display page 1/7 anymore. I know that I could use if.isInList and the provide all subpage IDs, but then I'd have to change the TypoScript everytime I add a new page. If possible, I'd like to dynamically exclude a page and all its subpages.

How can I do that?

Upvotes: 1

Views: 1732

Answers (2)

Andr&#225;s Ott&#243;
Andr&#225;s Ott&#243;

Reputation: 7695

As Daniel mentioned in his answer there is a way to display all subpages of the selected pages. special = directory displays however only the subpages. So you could see only 2/3 and 5/6 and 8/9 in your menus.

special = directory

"This will generate a menu of all pages with pid = 35 and pid = 56."

I would suggest the excludeUidList property.

HEADERMENU = HMENU
HEADERMENU {
    excludeUidList = 7
    1 = TMENU
    1.expAll = 1

    2 < .1
}

FOOTERMENU < HEADERMENU
FOOTERMENU.excludeUidList = 1

It is working as a WHERE condition in a db SELECT query, so you won't get those pages on the first level and neither will it find their subpages then.

Upvotes: 1

Daniel
Daniel

Reputation: 7036

You could go for the special=directory approach to render a Menu of one or more pages and their subpages.

HEADERMENU.special = directory
HEADERMENU.special.value = 1, 4

More information in the documentation.

Upvotes: 0

Related Questions