Description
You are able to automatically build a Menu strucure on your Top navigation bar with the ListPages module - by selecting only a specific category (or tag, or combinations):
- use the separate= "no" attribute (inserts no div's per entry)
- use the prependLine attribute with the content of the menu-header - either
- a literal like prependLine="* [# Menu-pages]" or
- a link to a page like prependLine="* [[[start-buchecke | Buchecke]]]"
- use as <custom body> of the ListPages module
- a comment line as 1. line AND
- as 2. line the " * %%linked_title%%" variable ( notice the space before the star!)
- if you want you can use the limit="nn" attribute for security only not to explode the top nav menu…
Code
[[module ListPages category="buchecke" separate="no" prependLine="* [# Buchecke]"]]
[!-- --]
* %%linked_title%%
[[/module]]
[!-- notice the comment (2.) line and the space before the star (in the 3. line --]
Notes
1. The secret is the comment line before the variable line.. I forgot who have detected this…
Why ? The parser eliminates every space before and after a parameter value. Means: instead of " * xyz" the result is "* xyz" and the important space before the "*" is gone.
With a comment (line) before the variable the parameter has the content of "[[!-- any comment --] * Xxx" and the important space before the "*" is not erased. (Thanks to ErichSteinboeck who explained the reason in detail).
2. Another important issue is the possible, but unneccessary and dangerous space line between the different menu-items:
Avoid any blank line between the menu items. Wrong is following code:
* [[[start | Menue]]]
* [[[start | Willkommen]]]
* [[[Nachrichten]]]
* [[[forum:start | Forum]]]
* [[[forum:recent-posts | Neueste Post]]]
* [[[forum:minirecent-threads | Neueste Threads]]]
* [# Hilfe]
* [*http://www.wikidot.com/doc Documentation]
* [*http://www.wikidot.com/doc:wiki-syntax wiki-syntax]
* [[[contact]]]
The blank lines will create stairsteps-like menu-bars on some themes..
( thanks to mattdm for this findings)
Better is always to avoid the blank lines:
* [[[start | Menue]]]
* [[[start | Willkommen]]]
* [[[Nachrichten]]]
* [[[neue-seite-anlegen | Neue Seite anlegen]]]
* [[[system:join| Site Mitglied werden]]]
* [[[forum:start | Forum]]]
* [[[forum:start | Gruppen-Übersicht]]]
* [[[forum:recent-posts | Neueste Post]]]
* [[[forum:minirecent-threads | Neueste Threads]]]
[[module ListPages category="buchecke" separate="no" prependLine="* [[[start-buchecke | Buchecke]]]"]]
[!-- --]
* %%linked_title%%
[[/module]]
* [# Hilfe]
* [*http://www.wikidot.com/doc Documentation]
* [*http://www.wikidot.com/doc:wiki-syntax wiki-syntax]
* [*http://community.wikidot.com/howto:howto-list How-To's]
* [*http://handbook.wikidot.com/ HANDBUCH]
* [[[How to edit pages?]]]
* [# Internals]
* [[[system: Recent changes]]]
* [[[system: List all pages]]]
* [[[admin:manage|Site Manager]]]
* [[[contact]]]
In action
Easy to show..I used above code on a public site Turnen at bp:
have a look on the top nav menu point "Buchecke" - the entries are build automatically with the code inserted above!
Rate this solution
If you think this solution is useful — rate it up! Or dump it otherwise.





