[pmwiki-users] Changing the Page Action on Page Load

Bruce & Ann Reidenbach bereiden at gmail.com
Wed Sep 1 13:55:04 CDT 2010


OK, so I have attempted to create a (:pageaction :) markup element, but I
can't make it work.  I'm enough of a noob to not understand what the problem
is.  I know that PageAction is being called because I stuck some debug
strings in there and they were being displayed on the page.  It just appears
that setting the action to text is not working properly.

Here's the code I wrote:

<?php if (!defined('PmWiki')) exit();

#
--------------------------------------------------------------------------------------------------
# Page Action markup
#
--------------------------------------------------------------------------------------------------
#
# When a page is opened, apply the action specified by the (:pageaction
myaction:) markup

$RecipeInfo['PageAction']['Version'] = '2010-09-01';

# Catch all text between (:pageaction and :) and call PageAction

Markup ('PageAction', 'directives', '/\\(:pageaction\\s+(.+?)\\s*:\\)/ei',
"PageAction ('$1')");

# Change the page action when the page is opened

function PageAction ($text) {
  global $action;
  if ($action == 'browse') $action = $text;
}

?>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.pmichaud.com/pipermail/pmwiki-users/attachments/20100901/db9a5df8/attachment.html>


More information about the pmwiki-users mailing list