Menu

For a couple of websites now, I decided to cut the menu into two parts:

  1. First-level entries
  2. Second- and following sublevel entries

The idea is following for this very website whose pages’ hierarchy is similar to:

root
|-- Tutorials
| |-- TYPO3
| | |-- Complete website
| | `-- …
| `-- LaTeX
| |-- Articles
| `-- …
|-- Programming
| `-- …
|-- Multimedia
`-- Internet

First-Level Entries

The goal is to get a list with main topics:

  • Tutorials
  • Programming
  • Multimedia
  • Internet

That’s easy as we only need to configure a single level of menu entries:

lib.menu = HMENU
lib.menu.1 = TMENU
lib.menu.1 {
	noBlur = 1
	wrap = <ul>|</ul>
	NO {
		wrapItemAndSub = <li>|</li>
		ATagTitle.field = description // subtitle // title
	}
	ACT = 1
	ACT {
		wrapItemAndSub = <li class="active">|</li>
		ATagTitle.field = description // subtitle // title
	}  
}

Following Level Menu Entries

The goal is to get a list of pages for the currently selected topic. Thus, if “Tutorials” is active, we should get:

  • TYPO3
    • Complete Website
  • LaTeX
    • Articles

That’s easy with the parameter entryLevel:

lib.submenu = HMENU
lib.submenu.entryLevel = 1
lib.submenu.1 = TMENU lib.submenu.1 { # Expand next sublevel expAll = 1 noBlur = 1 wrap = <ul>|</ul> NO { wrapItemAndSub = <li>|</li> ATagTitle.field = description // subtitle // title } ACT = 1 ACT { wrapItemAndSub = <li class="active">|</li> ATagTitle.field = description // subtitle // title } }   lib.submenu.2 < lib.submenu.1 lib.submenu.2 { # Do not expand further expAll = 0 }   lib.submenu.3 < lib.submenu.2 lib.submenu.4 < lib.submenu.3

I only configured 4 sublevels of menu entries, but I think you got it, didn’t you? You may have noticed too, that I defined lib.menu and lib.submenu. These are 2 objects that I may include in my TemplaVoilà! template.

Flattr