[TYPO3] Partial menu generation

Jeppe Vesterbæk jhve02 at control.aau.dk
Thu Feb 16 00:23:34 CET 2006


Hi,

Suppose I have a tree structure like this:

- Page ID=1 (level 1)
- Page ID=2 (level 1)
    - Page ID=3 (level 2)
    - Page ID=4 (level 2)
          -Page ID=5 (level 3)
          -Page ID=6 (level 3)
-Page ID=3 (level 1)

How do I dynamically generate a new menu given a page ID? Say we want a 
menu with ID=4 as pageroot, this menu shold look like (example 1):
- Page ID=4 (level 1)
    -Page ID=5 (level 2)
    -Page ID=6 (level 2)

or if menu root is ID=2 and selected page is ID=6, show this menu 
(example 2):
- Page ID=2 (level 1)
    - Page ID=3 (level 2)
    - Page ID=4 (level 2)
          -Page ID=5 (level 3)
          -Page ID=6 (level 3)

I'm doing this way:

temp.menu_doc.special = list
temp.menu_doc.special.value={GPvar:menuroot}
temp.menu_doc.special.value.insertData = 1

temp.menu_doc.entryLevel=0

[globalVar = GP:menuentrylevel = 1]
temp.menu_doc.entryLevel=1
[globalVar = GP:menuentrylevel = 2]
temp.menu_doc.entryLevel=2
[globalVar = GP:menuentrylevel = 3]
temp.menu_doc.entryLevel=3
[globalVar = GP:menuentrylevel = 4]
temp.menu_doc.entryLevel=4
[global]

So, to generate my menu in (example 1), my query string looks like: 
index.php?id=5&menuroot=4&menuentrylevel=1
To generate the menu in (exampe 2), my query string look like 
index.php?id=6&menuroot=2&menuentrylevel=0

This solution DOES WORK! BUT,  it is not a nice solution because:
1) I need to know the entrylevel of the menuroot page
2) Quote TSREF p. 72: "NOTE: Don't set .entryLevel for a HMENU when 
using this option!"

But I need to set the entrylevel because (also from TSREF p. 72): "Also 
be aware that this selects pages for the first level in
the menu. Submenus by menuPbjects 2+ will be created as usual."

To sum up, what I want to do is the specify a page ID in the query 
string that defined the new "menuroot".

Comments?

Thanks,
Jeppe Vesterbaek




More information about the TYPO3-english mailing list