By Helmut_pdorf
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!
Thanks to tsangk for this great snippet: conditional-blocks
text above inserted with:
[[include :snippets:if START |unique=1|type=equal|var1=%%name%%|var2=conditional-blocks]]
**##red|Thanks to tsangk for this great snippet:##** [[[code:conditional-blocks]]]
[[include :snippets:if END]]
Other snippets posted by Helmut_pdorf
Todo List with Data Forms - 30 Apr 2015 14:59
Html(embed) code opening in new window/tab - 29 Oct 2014 09:05
Facebook Button - 27 Dec 2013 15:03
Sorted-ListPages-List - 19 Aug 2013 15:56
Advanced Search - 25 Feb 2012 12:29
Schedules - 16 Feb 2012 01:40
Use any html code on a page - 16 Feb 2012 01:34
Find untagged pages - 15 Feb 2012 00:52
Rate this solution
If you think this solution is useful — rate it up!
By chance I have deleted my old example site … and now I restored it… but noiw I detected this site is "private"… I need another test site to show this in action…!
Service is my success. My webtips:www.blender.org (Open source), Wikidot-Handbook.
Sie können fragen und mitwirken in der deutschsprachigen » User-Gemeinschaft für WikidotNutzer oder
im deutschen » Wikidot Handbuch ?
The listpages module causes a div-block, which in (some?) themes causes a break before/after. You will have to make a custom theme based on your chosen theme where you modify the css to make sure that both the #top-bar ul as well as the list-pagesbox are inline elements:
Admin Manage—> appearences —>Custom Theme —> New
.list-pages-box{
display:inline;
}
#top-bar ul{
display:inline;
}
I am having issues as well with the module adding unwanted spaces to my nav:top menu. These spaces create new lines with my theme. I don't want to change the theme, is there a hack for removing the spaces the module adds before and after the page list?
Looking at http://surreal64ce.wikidot.com/nav:top I notice that you haven't got the ListPages code in there at the moment.
There is probably a way to do this using either wikidot syntax or CSS, but I can't help you find a solution until I get home (CSS themes not working for me at the moment). Only thing I can suggest is to try it in the middle of two regular menu items, rather than putting the ListPages module at the beginning or end of the list of menu items. And to avoid blank lines.
~ Shane (Wikidot Community Admin - Volunteer)
Wikidot: Wikidot Editor, Official Docs
Other: YouTube (gaming, primarily Minecraft)
It seems that:
Creates a new "<li>" item in the unordered list, but it doesn't add the proper closing "</li>" which causes the top nav to stair-step.
Hard coded:
Result in HTML:
Then with the ListPages module:
Result in HTML:
It almost seems like it should be:
But it doesn't render the inline html properly :(
Caution: ListPages inserts a div into the menu. This will probably be invisible to most themes, but it may cause problems in rare cases.
In my case I am listing help pages, and it is possible that over time too many pages will be created to put them all in a menu. So I limited the list to ten items and added a "More…" item at the bottom of the list that brings up an index page (as does the top-level menu item itself.)
I am using the Webbish (default) theme. But when I use listpages in nav:top, the menu items get listed vertically?
I need the menu items horizontal. In some themes, I get the desired result. But I am a big fan of the Webbish default theme and want to keep using it.
Also in the listpages list, can I add a horizontal line (separator), so that it is easy to make out individual list items?
can u help?
Than you should try without the comment line ( which inserts the blank before the star) and without the prependLine="* [[[Start_menu..xyz]]]"
But do not forget the limit="4" or so … or you will explode the nav:top bar
I cannot test this now on ome of my sites..
Edit: I use such listpages on my test-site: http://helmuti-pdorf.wikidot.com/nav:top ( "flash" menu) - and "iftags" to show different menus…
Service is my success. My webtips:www.blender.org (Open source), Wikidot-Handbook.
Sie können fragen und mitwirken in der deutschsprachigen » User-Gemeinschaft für WikidotNutzer oder
im deutschen » Wikidot Handbuch ?