Recent Changes - Search:

Cookbook

PmWiki

pmwiki.org

EditThisPageLink

Summary: short markup for a link to 'edit this page'
Version: 2007-10-03
Prerequisites: PmWiki 2.2.0-beta1
Status:
Maintainer:
Categories: Markup Editing

Description

The following markup definition provides a short (:edit:) markup, which is exactly equivalent to the longer standard [[{$FullName}?action=edit|edit]] link markup. For instance you can use it on included pages as a shortform to provide a link to edit the included page. Add this to config.php:

Markup('(:edit:)', 'directives', '/\\(:edit:\\)/ei',
  "'[[('.PageVar(\$pagename,'\$FullName').'?action=)edit]]'");
$QualifyPatterns['/\\(:edit:\\)/ei'] =
  "'[[('.PageVar(\$pagename,'\$FullName').'?action=)edit]]'";

Explanation

$QualifyPatterns: When the (:include:) directive retrieves a page content, the included text is processed (qualified) to transform "relative" variable references to "absolute" ones, {$SomeVar} in the included page becomes {Group.IncludedPage$SomeVar}, which resolves as expected when the page is finally rendered. The internal $QualifyPatterns variable maintains the dedicated search/replacement regular expressions.

PageVar: The function PageVar($pagename, '$VarName') retrieves the value of a page variable for the page given by $pagename.

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 December 30, 2007, at 04:36 PM