|
Cookbook /
TitleMarkupSummary: 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:
Categories: Administration Markup
Questions answered by this recipeHow can I set page titles so included pages will not override my titles? DescriptionThis 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++;
}
NotesRelease Notes
See Also
ContributorsComments |