GroupTitle

Summary: Define a title for an entire WikiGroup
Version: 20220219
Prerequisites: pmwiki-2.1
Status: Stable
Maintainer: Petko (original author: Pm)
Discussion: GroupTitle-Talk

Questions answered by this recipe

  • How can I define a title for an entire wikigroup?

Description

This recipe adds {$GroupTitle} and {$GroupTitlespaced} page variables. The group title is taken as the first title (for instance (:title My Group Title:)) found in GroupAttributes, GroupHeader, GroupFooter, Group.Group (i.e. $Group.$Group), or Group.HomePage (i.e. $Group.$DefaultName). If none of these pages have titles, then the name of the group is used (spaced according to $GroupTitlespaced or $SpaceWikiWords).

Notes

From version 2.3.11 PmWiki has the following page variables derived from the group's homepage built in:

  • {$GroupHomePage} - full name of the homepage = "Cookbook.Cookbook"
  • {$GroupHomePageName} - its {$Name} = "Cookbook"
  • {$GroupHomePageTitle} - the {$Title} = "Cookbook"
  • {$GroupHomePageTitlespaced} - the {$Titlespaced} = "Cookbook"

but not

  • {$GroupHomePageNamespaced} - its {$Namespaced} = ""
    • Although you can do {{$GroupHomePage}$Namespaced} = "Cookbook"

Download grouptitle.phpΔ into the cookbook/ directory, and then add the following to a local customization file:

include_once("$FarmD/cookbook/grouptitle.php");

The $GroupTitlePathFmt variable can be modified to search a different set of pages for a group title.

# use only GroupAttributes for a group title
$GroupTitlePathFmt = '$Group.GroupAttributes';
# use only GroupHeader and GroupFooter for a group title
$GroupTitlePathFmt = array('$Group.GroupHeader', '$Group.GroupFooter');

To display the GroupTitle instead of the usual Group name in a page's titlebar, you will most likely need to modify the skin's template file, so that the name in the normal link at the page head for the Group is replaced by $GroupTitle or $GroupTitlespaced. I.e. in the skin tmpl file change $Group or $Groupspaced to $GroupTitle or $GroupTitlespaced, but only for the name of the group between the <a ...> </a> tags of the link to the group (in the titlebar or header section). Do NOT replace EVERY occurrence of $Group or $Groupspaced with $GroupTitle or $GroupTitlespaced. If you cannot understand the code, seek online help or contact the skin author.

Some skins have built-in support for GroupTitle, and will show it when it is defined with a (:title ...:) directive as outlined above. But you would still need to install this recipe script.

Skins with built-in GroupTitle support: Gemini, FixFlow, Triad.

See Also

Change log / Release notes

  • 20220219 Update for PHP 8.

Contributors

Comments

See discussion and sandbox at GroupTitle-Talk

User notes? : If you use, used or reviewed this recipe, you can add your name. These statistics appear in the Cookbook listings and will help newcomers browsing through the wiki.