|
Cookbook /
ExpandingMenusSummary: How to create a sidebar menu which expands to show sublevel items
Status: Stable
Version:
Prerequisites: pmwiki-2.0
Maintainer:
Votes: 5
QuestionHow can I create a compact sidebar menu which expands to show sublevel items when clicking on first level items? AnswerMake sure the skin you use can display first and second level list elements. Build your Sidebar embracing selected list elements in an Example SideBar *[[GroupOne/GroupOne]] (:if group GroupOne:) **[[GroupOne/Page1]] **[[GroupOne/Page2]] **[[GroupOne/Page3]] (:if:) *[[GroupTwo/GroupTwo]] (:if group GroupTwo:) **[[GroupTwo/Page4]] **[[GroupTwo/Page5]] **[[GroupTwo/Page6]] (:if:) *PmWiki (:if group PmWiki:) ** [[PmWiki/Installation | Download and Install]] ** [[PmWiki/Tips For Editing]] ** [[PmWiki/Documentation Index]] ** [[PmWiki/FAQ]] (:if:) To avoid having each group edit the Main.SideBar you can expand on this idea and allow each group to have its own SideBar-Menu page conditionally included like this: Example SideBar
*[[GroupOne]]
(:if group GroupOne:)(:include {$Group}.SideBar-Menu:)(:if:)
*[[GroupTwo]]
(:if group GroupTwo:)(:include {$Group}.SideBar-Menu:)(:if:)
*[[PmWiki]]
(:if group PmWiki:)(:include {$Group}.SideBar-Menu:)(:if:)
Example Group.SideBar-Menu Note: You do not have to fully qualify the group pages. **[[Page1]] **[[Page2]] **[[Page3]]
See alsoNotes and CommentsContributors
Question:Is it possible to arrange within one While you can't nest conditional statements, what you want simply requires that you display a second (or third) group within a single condition. That shouldn't be a problem. Using the example at the top of this page, if you wanted GroupOne and GroupTwo to display when on a page in GroupOne, then you would just get rid of the first (:if:) ending (After *[[GroupOne/Page3]]) and the second (:if group GroupTwo:) (after *[[GroupTwo/GroupTwo]]) Pico May 18, 2006, at 07:51 AM
Well, yesterday I've already solved that problem via (:if group GroupA or GroupB:)...(:if:). Maybe I should have checked the ConditionalMarkup earlier... But anyway - thank you.
Expansion IdeaWithin the conditional part, use PageLists to automatically list all the pages in the group. Dec 14,2006 Sandy |