Recent Changes - Search:

Cookbook

PmWiki

pmwiki.org

TitleMarkup

Summary: setting a page title with the first title markup, subsequent titles (from included pages etc.) are ignored
Version: 2008-01-27
Prerequisites: PmWiki 2
Status:
Maintainer:

Questions answered by this recipe

How can I set page titles so included pages will not override my titles?

Description

This is an alternative title markup definition setting the title with the first title directive.

Adding the following to config.php will define the title markup so that "the first title encountered wins", subsequent title directives (on included pages or otherwise) will be ignored. Any $ indicating some variable injection is also defused (while page variables and page text variables will continue to work inside the markup):

## (:title ...:) First title wins, any subsequent (:title ...:) is ignored.
Markup('title','directives',
  '/\\(:title\\s(.*?):\\)/ei',
  "SetTitleMarkup(\$pagename, PSS('$1')) ");
function SetTitleMarkup($pagename, $arg) {
   static $tset = 1;
   $arg = str_replace('$','$',htmlspecialchars($arg, ENT_NOQUOTES));
   if ($tset==1)
      PCache($pagename, $zz=array('title' => SetProperty($pagename, 'title', $arg )));
   $tset++;
}

Notes

Release Notes

If the recipe has multiple releases, then release notes can be placed here. Note that it's often easier for people to work with "release dates" instead of "version numbers".

See Also

Contributors

Comments

Edit - History - Print - Recent Changes - Search
Page last modified on May 07, 2008, at 08:00 AM