0
votes

This may sound strange, but I have a menu where the first page has no real subpages. However, it has an appended COA with 2 custom TMENU's and a plugin insertion.

But: The subnavigation for this page is only generated when I add a visible subpage to this page (which would be a workaroud). Is there a better solution to get this menu visible?

Here's the typoscript:

field_main_navigation = HMENU
field_main_navigation {

    1 = TMENU
    1 {
        expAll = 1

        NO. wrapItemAndSub = <div class="wrap-itemAndSub">|</div>

        ACT < .NO
        ACT = 1
        ACT.ATagParams = class="active"
    }

    2 = TMENU
    2 {
        wrap = <div class="sub clearfix" style="display: none;">|</div>

        # Custom build for page 2
        stdWrap.wrap.append = COA
        stdWrap.wrap.append {
            if.value.field = pid
            if.equals = 2

            # a lot of typoscript, basically:
            # two COA's, one with two HMENU, the 
            # other one with plugin content
            10 = COA
            # ...

            20 = COA
            # ...
        }


        NO = 1
        NO {
            allWrap = <li>|</li>
        }
    }
}

To explain what I want to achieve
Basically it is a simple "show submenu on hover". Just the first item has special content in its hover submenu. Because there are no actual subpages that [ nav 1 ] contains, no submenu is rendered.

[ nav 1 ] [ nav 2 ] [ nav 3 ]
|------div.sub style="display: none;" *-------|
|  ( Custom TMENU )  |    (Plugin Content)    |
|                    |                        |
|--------------------|------------------------|
|  ( Custom TMENU )  |    ( Usual submenu ** )|
|                    |                        |
|---------------------------------------------|

* Pops out when hovering over [ nav 1 ]

** this _may_ be the case in the future, but 
   currently not. here's the problem

That lead me to another question (just now): Should I do all this in my usual HMENU/TMENU or should I render a normal HMENU/TMENU and prepend nav-1 as a typoscript-generated custom navigation point with custom subnavigation layer?

1
As your custom content should be placed after the submenu, that is equivalent to placing where I put XXX in this, right? NO.wrapItemAndSub = <div class="wrap-itemAndSub">|XXX</div>tmt
updated question (with another question at the bottom..)pdu
If the items in the first level don't change (that is page with UID 2 is always there), then you can simply place that together with your custom TypoScript before the menu and exclude that page in the HMENU. My answer takes into account that that page might not be there. Does it work for you?tmt
works more or less, the problem is within the submenu. but I accept it because it is a solid solution. thank you!pdu
What's the problem in the submenu?tmt

1 Answers

1
votes

Place your custom content on the first level menu setup. Try this:

field_main_navigation = HMENU
field_main_navigation {
  1 = TMENU
  1 {
    expAll = 1

    NO.wrapItemAndSub {
      append = COA
      append {
        if {
          value.field = uid
          equals = 2
        }

        # a lot of typoscript, basically:
        # two COA's, one with two HMENU, the 
        # other one with plugin content
        10 = COA
        # ...

        20 = COA
        # ...
      }

      wrap3 = <div class="wrap-itemAndSub">|</div>
    }

    ACT < .NO
    ACT = 1
    ACT.ATagParams = class="active"
  }

  2 = TMENU
  2 {
    wrap = <div class="sub clearfix" style="display: none;">|</div>

    NO = 1
    NO {
      allWrap = <li>|</li>
    }
  }
}

NOTE: I'm a bit confused by the wrap on the second TMENU. Do any of the 1st level items have any real subpages?