[pmwiki-users] How to specify target page for search results?

Patrick R. Michaud pmichaud at pobox.com
Fri Jan 12 07:28:44 CST 2007


On Fri, Jan 12, 2007 at 02:23:21PM +0100, Roman wrote:
> Patrick, thank you for your help, that's what I was looking for. Just
> a little question regarding URL
> 
> URL Before:
> http://server/wiki/?n=CurrentGroup.CurrentPage&action=search&q=test
> 
> URL Now:
> http://server/wiki/Site/Search?&action=search&q=test
> 
> Notice first ampresand following question mark. Can it cause any problem?

Oops.  It's probably not a problem, but we should be more
correct.  Try the following instead

  if ($action == 'search') {
    $pagename = ResolvePageName($pagename);
    if ($pagename != 'Site.Search') {
      $qs = preg_replace('/\\bn=[^&?]*[&?]?/', '', @$_SERVER['QUERY_STRING']);
      Redirect('Site.Search', "\$PageUrl?$qs");
    }
  }

Pm




More information about the pmwiki-users mailing list