ReferrerMarkup

<< | Cookbook-V1 | >>

Note: The recipes here are for PmWiki versions 0.6 and 1.0 only. For PmWiki 2.0 recipes, see Cookbook.


Goal

Add markup that creates a link to the referring page.

Solution

Add the following lines to local.php:

  $DoubleBrackets['/\\[\\[\\$Referr?er(\\s+.*?)?\\]\\]/'] =
    '[['.@$HTTP_SERVER_VARS['HTTP_REFERER'].'$1]]';

Discussion

Sometimes an author will want to provide a link back to the page that referred the user to the current page--similar to the "Back" button available in most browsers. The above lines add [[$Referer text]] markup to PmWiki; "text" is displayed as a link to the referring page. For example, the markup [[$Referer back]] results in $Referrer back?.

For historical reasons the HTTP_REFERER header is in fact misspelled ("referer" instead of "referrer"), so it may be useful to allow both spellings as done above.

See Also

  • PmWiki.CustomMarkup

Contributors

  • Patrick Michaud
  • Rene Grabner

pmwiki-2.3.38 -- Last modified by {{}}?

from IP: 85.171.160.186 ip should be disabled by default for security reasons