[TYPO3] HMENU and entryLevel with multiple trees (top menu /left menu)

Tomas Mrozek mail at cascaval.com
Tue May 15 19:38:16 CEST 2007


> There probably is a better solution...

I think so. I was actually partly suggesting...

> The easiest way I've found to handle this is to create 2 trees at the
> rootline...

The problem of this is that it affects generated URLs if you are using
RealURL, for you have one useless level.

What I was playing with lately is using the property "Layout" in the
page properties.

Assumptions:
-----------
1. I have no other use for it (actually, I don't know what it was meant for)

2. The content of the pulldown menu can be modified:
http://castor.t3o.punkt.de/files/podkast_arnd.m4v (40 MB)
http://typo3.org/documentation/document-library/references/doc_core_tsconfig/4.1.0/view/1/3/#id3541144

3. The value set is accessible: column "layout" in the table "pages'

4. You can populate the menu yourself by your own PHP function.

So...
-----
1. ...you can change the pulldown menu:

TCEFORM.pages {
  layout {
    disabled = 0
    altLabels {
      0 = Top menu
      1 = Left menu
    }
    removeItems = 2,3
  }
}

2. ...and populate the menus by your own function:

subparts.TOPMENU = HMENU
subparts.TOPMENU.special = userfunction
subparts.TOPMENU.special {
  userFunc = user_myClass->myMenu
  layout = 0
}

subparts.LEFTMENU = HMENU
subparts.LEFTMENU.special = userfunction
subparts.LEFTMENU.special {
  userFunc = user_myClass->myMenu
  layout = 1
}

3. ...while the function "myMenu" would look something like:

class user_myClass {
  function mymenu($content,$conf) {
    $menuPosition = $conf['layout'];
    $menuContent = array();

    /* your own logic to load the pages from 'pages' table
     * by your SQL query that contains
     * statement WHERE layout = menuPosition
     * and that populates the array $menuContent */

    return $menuContent;
  }
}

This way editors can choose which menu the page goes in by selecting
appropriate "layout".

Tomas Mrozek


More information about the TYPO3-english mailing list