|
Cookbook /
SubgroupMarkupSummary: Add one level of subpage using [[,subpage]] markup
Version: 2.1.5
Status: Stable (was SubpageMarkup)
Prerequisites: pmwiki 2.0 and above; 2.1 recommended
Maintainer: jr
GoalProvide a simple way to solve certain problems that would otherwise require use of a hierarchical page naming scheme. SolutionThe subpages recipe adds one level of subgroup to PmWiki's Group.Page structure, by introducing a [[,subpage]] markup. It extends the AsSpaced function so that Page,Subpage is spaced as Page, Subpage. Place the subpages.php file in the local/ directory. Add the following line to local/config.php include_once("Usage: Put
[[,Child]] on the current page to create a reference to the page called SubpageMarkup,Child. Subpages do not nest: a reference to It adds a modified trail markup, through the (:subpage:) directive. Suppose the parent page contains a list of subpages and a subpage directive: (:subpage:) * [[,page 1]] * [[,page 2]] On display, the subpage directive generates a button allowing a reader to toggle between showing and hiding the contents of the subpages as part of the parent page. If the author adds (:subpage action=print:) it adds an option of generating a print view of the page and its subpages. Because of the way pmwiki.php is structured, this recipe doesn't work as a per group customisation. There is a work-around, discussed below. DiscussionThis recipe is designed as a simple solution to the page disambiguation problem -- when you want to give different pages in the same group the same name. There are 2 distinct cases: ambiguous parents and ambiguous children. The following examples are to illustrate the idea of subpages. There is always more than one way to do it; subpages may not be the best. It's up to the administrator to decide the most appropriate strategy in any given case. Subpages are functionally equivalent to adding one level of subgroup to PmWiki -- the subpages of a given page form a subgroup. Ambiguous parentsConsider the movie The Italian Job. Is this a reference to the ultra-cool '60s original or the leaden 2004 remake? We would create 3 pages: TheItalianJob might give a plot synopsis. It would also include links to Another example: is The script includes an $EnableDisambiguation parameter. If ($EnableDisambiguation = 1), a reference to Ambiguous childrenConsider the Profiles group. People may wish to describe their An example from the PmWiki mailing list was a group that consists of TeamA, TeamB and so on. Each team has a If you set $EnableDisambiguation = 2, the script displays a reference to Subpages form a subgroupAnother way of thinking about subpage markup is that it adds one level of subgroup to PmWiki's standard Group.Page structure. Taken together, the subpages of a particular page form a subgroup within the current group. The recipe supports subgroup customisations. It extends the standard pgcust capability to apply a local page customisation (local/Group.Page.php) to a page and all its subpages. LimitationsThe script redefines the A case can be made that subpages introduce unnecessary complexity and confusion. Remembering the PmWiki philosophy to avoid gratuitous features, a prudent approach would be to use them only after you have considered the alternatives and are really sure you need them. On the other hand, if you think that you need hierarchical groups, consider whether subpages (which add subgroups) are all you really need. Since the purpose of SubpageMarkup is to solve the page disambiguation problem, subpages do not nest. The contributor has not been able to think of a problem that nested subpages would solve, and sees several problems that nested subpages would create. In particular, the markup does not readily scale to multiple levels of hierarchy. Notes related to problems with beta 19 and later
Release history04 July 2006 -- version 2.1.5 handles show/hide of subpage list items that start or end a page 19 June 2006 -- version 2.1.4 adds subpage list show/hide feature Contributor |