[pmwiki-users] Recipe Update: Fox
design5 at softflow.co.uk
Tue Jan 29 05:27:19 CST 2008
Monday, January 28, 2008, 8:03:54 PM, The Editor wrote:
> The pagelist retrieves the list of pages, then a simple expression
> markup in the pagelist template retrieves the first line in the page
> with the searched term (passed to it from the pagelist directive),
> highlighting the term. Of course you could format the template any
> other way.
Thanks for your hint!
I just tested this idea by just adding a condition to the main
function of the extract.php script, which checks if $FmtV['$Needle']
is set, and sets the search pattern to this.
That way I could use a standard (:searchbox :) with a custom
fmt=#extract, and define this #extract template with the extract
This works without any modifications to pagelist.php.
But it is a lot slower than using the custom (:extract:) searchbox or
using a fox form as a searchbox. And the results are not as
I think the slow speed (a third slower) results from pagelist first
opening all pages to look for the query term, and then the expression
in the fmt template opens every page pagelist provides again to find
the term, process directives, do the highlighting etc.
I do not know why I get more comprehensive results with
(:extract:). Perhaps pagelist is ignoring matches to terms in markup.
A big difference to your context-sensitive searchbox on your site
is that TextExtract finds all matches, not just the first one.
Another is the use of regex, which matches a string even if it is
inside another word. One needs to specify wordboundaries specifically
(with regex \b ), which I think is an advantage, as terms are often
just part of a word.
All this has little to do with the Fox update, apart from that one can
build customised search forms now.
But the big thing with the new foxaction=display is that it offers
more possibilities of form controlled data(content) extraction and
More information about the pmwiki-users