[pmwiki-users] Fox Filter Question (corrected)

Hans design5 at softflow.co.uk
Mon Jan 12 03:53:11 CST 2009


Monday, January 12, 2009, 6:22:31 AM, James DeVain wrote:

> I want to create a fox filter which would remove all
> commas from any feild named "pagename". What I have
> so far is:

> $FoxFilterFunctions['nocomma'] = 'nocomma';
>    function nocomma($pagename, $fields) {
>     $fields = preg_replace('/,/', ' ', $fields);
>    return $fields;


> This filters commas from every field. How would I make
> it filter only fields named "pagename"?

use this function instead:

$FoxFilterFunctions['nocomma'] = 'nocomma';
function nocomma($pagename, $fields) {
    $fields['pagename'] = preg_replace('/,/', ' ', $fields['pagename']);
return $fields;
}

> Is there a way
> to apply the filter to one specific feild just using
> the form markup, or do I need to specify that in the
> filter itself?

you have to do that in the function. Fox will just run the filter
function, if it is specified as foxfilter in the form, regardless of
any field names. I.e it is generic, and not aimed at
processing (filtering) just a specific field.



  ~Hans




More information about the pmwiki-users mailing list