[pmwiki-users] Using Searchbox: restricting to a ptv

ABClf languefrancaise at gmail.com
Wed Jan 27 23:29:57 CST 2010


Did you look at TextExtract ?
I guess it can work as expected, though I'm don't know how to do ;)
If I'm not wrong, the idea would be : search some (whole match and
regex possible) pattern in lines beginning with (:Fruit:

Hope this helps ;

Gilles.




2010/1/28 Petko Yotov <5ko at 5ko.fr>:
> On Monday 25 January 2010 15:04:38, Graham Archer wrote :
>> I would like to setup a searchbox where if the user types in the word
>> Apple,  it would only apply to the ptv Fruit and not to any other ptv.
>> At the moment in the above example the search returns both pages 1 and 2
>> results, whereas I would want it only to return page 1 with the ptv
>> (:Fruit:Apple:)
>
> Unfortunately, this is only possible out of the box if the user writes in the
> search field :
>  $:Fruit=Apple
>
>
> It is quite complex to do it from a dedicated search box, and you should know
> some PHP and about PmWiki Forms.
>
> In config.php, you can intercept the PTV search string and append it to the
> regular search string which is "q", something like:
>
>  foreach ($_REQUEST as $key=>$value) {
>    if (substr($key, 0, 4)=='ptv_' && $value>'') {
>      $_REQUEST['q'] .= " $:".substr($key, 4)."=\"$value\"" ;
>    }
>  }
>
> In the search form, instead of or in addition to the input field named "q",
> you need to have a field named ptv_Fruit.
>
> So, in a default HTML form in the skin template, you replace
>  <input type='text' name='q' /> with
>  <input type='text' name='ptv_Fruit' />
>
> Or, if you have a search form in a wiki page,
> (:input form action={*$PageUrl} method=get:)
> (:input hidden n {*$FullName}:) (:comment this line may be optional:)
> (:input hidden action search:)
> (:input text $:Fruit:) (:input submit value="Search":)
> (:input end:)
> (:searchresults:)
>
> Here, instead of (:input text q:) we have (:input text $:Fruit:).
>
> Petko
>
> _______________________________________________
> pmwiki-users mailing list
> pmwiki-users at pmichaud.com
> http://www.pmichaud.com/mailman/listinfo/pmwiki-users
>



-- 
---------------------------------------
| A | de la langue française
| B | http://www.languefrancaise.net/
| C | languefrancaise at gmail.com
---------------------------------------



More information about the pmwiki-users mailing list