00899: Searchbox vs nice URLs issue

Summary: Searchbox vs nice URLs issue
Created: 2007-03-12 04:32
Status: Closed (Answered)
Category: Bug
From: Athan
Priority: 4
Version: 2.2.0 b35

Description: Top head searchbox action url is not compatible with nice URLs (.htaccess)

Steps to reproduce issue:

Go to http://www.pmwiki.org/wiki/PmWiki/PmWiki or any other pmwiki page
On top searchbox, simply click 'Go' (no need to enter searching string)
Searching results pagelist is displayed as http://www.pmwiki.org/wiki?n=PmWiki.PmWiki&action=search&q= (not a ...nice url)

Now go directly to searching page http://www.pmwiki.org/wiki/Site/Search
Click "Search" button (no need to enter something)
This time, the results pagelist is using nice url http://www.pmwiki.org/wiki/Site/Search?q=&action=search


There's not a clean way to fix this particular issue.

Ideally we'd like to set up the form to use {$PageUrl}, which would correctly detect whether $EnablePathInfo is set and generate the appropriate form of url. However, there are some browsers which do not understand query string parameters in the action= attribute of forms, and so we have to explicitly provide the n= parameter as part of the search form that is in the skin template, and thus it shows up in the resulting url.

The reason why things work for a (:searchbox:) directive embedded in the Site.Search page is that the searchbox is generated by a function that can check the setting of $EnablePathInfo and generate the n= parameter as appropriate. But since we don't have the equivalent ability in skin templates (short of adding a new page variable or specialized function), it's simpler to just leave things as they are.

A site that really cares about the difference can update the skin template to use the form appropriate for the site. At any rate, it doesn't seem worth complicating the pmwiki skin with fixing this bug until/unless there's a lot more demand for it.

Hope this helps,