Again, thanks to all for helping out here.  And thanks to Peter for the &quot;fancy&quot; suggestion.  Here is the code.<br><br><blockquote style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;" class="gmail_quote">

Markup (&#39;PageAction&#39;, &#39;&lt;include&#39;, &#39;/\\(:pageaction\\s+(.+?):\\)/ei&#39;,<br>        &quot;PageAction (&#39;$pagename&#39;, &#39;$action&#39;, &#39;$1&#39;)&quot;);<br><br># Change the page action when the page is opened<br>

#   If no incoming action is specified, i.e., (:pageaction myaction:), redirect with the requested<br>#   action if the current page action is &#39;browse&#39;.  Otherwise, redirect with the requested action<br>#   if the current page action matches the specified incoming page action from the option list.<br>

<br>function PageAction ($pagename, $action, $opt) {<br>  $args = ParseArgs ($opt);<br>  foreach ($args as $key =&gt; $req) {<br>    if (strlen ($key) == 0) {  #  No incoming action specified?<br>      $key = &#39;browse&#39;;         #  Default to &#39;browse&#39;<br>

      $req = $args[&#39;&#39;][0];<br>    }<br>    if ($action == $key &amp;&amp; $action != $req) {<br>      Redirect (&quot;{$pagename}?action=$req&quot;);<br>    }<br>  }<br>}<br></blockquote><div><br>It doesn&#39;t appear to work with some of the special actions like diff or upload, but other than that, it works pretty well.<br>

</div><br><div class="gmail_quote">On Wed, Sep 1, 2010 at 4:04 PM, Peter Bowers <span dir="ltr">&lt;<a href="mailto:pbowers@pobox.com" target="_blank">pbowers@pobox.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">


<div class="gmail_quote"><div><br></div><div>By the time your Markup() rule is called it is too late to change $action and make it have any effect. </div></div><br><div>PmWiki (in the big picture) does a bunch of configuration tasks and then it checks the value of $action and calls an action handler function based on the value of $action.  It is that action handler which then does everything else, including processing all the rules, including the one you have put in place.</div>



<div><br></div><div>Changing $action after the action handler is called is like shutting the barn door after the horse is gone...</div><div><br></div><div>The way I would solve it would be to redirect to the same page but with a different action=X parameter in the URL.  Make sure you check your $action first to avoid an infinite redirect and also to still allow yourself to edit the page, use diagnostics, etc.  If you want to get fancy you might want to look into (:pageaction browse=mynewaction print=myprint edit=myedit:) type of syntax which would allow mapping of various actions to other actions (take a look at the ParseArgs() function if you decide to try to implement this more generalized functionality).  </div>



<div><br></div><div>I&#39;m not personally seeing the utility of the rule, but the beauty of pmwiki is its flexibility in allowing everyone to use it in their own way...</div><div><br></div><font color="#888888"><div>-Peter</div>



</font></blockquote></div><br>