PageAction

Summary: Change the page actions on a page-by-page basis
Version: 2010-09-02
Prerequisites: PmWiki 2.2.14 and later (untested on prior versions)
Status: new
Maintainer: bereiden
Categories: Administration Links
Discussion: PageAction-Talk?

Questions answered by this recipe

How can I control or change the default page actions for individual wiki pages? For example, I want a certain page to always be viewed in print mode.

Description

This recipe lets you modify the page actions on a page-by-page basis

Installation

Download page-action.phpΔ, copy to the cookbook/ folder and include the following line in config.php:

include_once("$FarmD/cookbook/page-action.php");

Usage

The page action for each individual wiki page can be modified by including the following markup on the page:

(:pageaction action1=request1 action2=request2 ... :) or
(:pageaction request:)

In the first form, when a page is accessed with ?action=action1, the page will be displayed with action set to request1 instead. Similarly, if a page is accessed with ?action=action2, the page will be displayed with action set to request2.

In the second form, when a page is accessed with the default action (browse), the page will be displayed with action set to request.

For example,

(:pageaction print:)


would cause the wiki page to be viewed with the print skin whenever the page was accessed.

(:pageaction print=browse:)


would disable the print view from a wiki page.

Notes

  • The recipe works by redirecting access to a page with the action variable set to the requested value. Care has been taken in the recipe so that the page action cannot redirect to the same action (which would cause an infinite loop of redirections!).
  • The script does not change the page action for ?action=edit or ?action=history.

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".

  • 2010-09-02 - First Release

See Also

Contributors

Comments

See discussion at PageAction-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.