[pmwiki-users] foxfilter
noskule
noskule at gmx.net
Sun Apr 6 08:03:33 CDT 2008
noskule schrieb:
> hi hans
>
> I'm building a foxfilter to handle categories. It works fine, except if
> a user deletes all categories, respectively a empty categories field is
> submitted.
>
> the if part of the code below works fine. However if I submit an empty
> filed, "no-category" is written into the ptv. But if I change
> "no-category" to "" then the filed don't get updated.
>
> What I have to do now to get the ptv cleard. Thanks for any hints.
> nos
>
>
>
oky, I misspositioned ptvclear, is there a way to pass ptvclear also as
hidden var?
(: input hidden ptvclear Categories:)
> $FoxFilterFunctions['FoxCategories'] = 'FoxCategoriesFilter';
> function FoxCategoriesFilter($pagename, $fields) {
> $categories_string = $fields['ptv_Categories'];
> $categories_string =
> preg_replace("/^[^A-Za-z0-9]*/","",$categories_string);
> $categories_string =
> preg_replace("/[^A-Za-z0-9]*$/","",$categories_string);
> $categories_string =
> preg_replace("/[^A-Za-z0-9\s-]*/","",$categories_string);
> if ( $categories_string != "" ) {
> $categories_arr = explode(" ",$categories_string);
> for($i=0;$i<count($categories_arr);$i++) {
> $out = $out."[[!".$categories_arr[$i]."]] ";
> }
> }
> else $out = "no-category";
> $fields['ptv_Categories'] = $out;
> return $fields;
> }
>
> _______________________________________________
> pmwiki-users mailing list
> pmwiki-users at pmichaud.com
> http://www.pmichaud.com/mailman/listinfo/pmwiki-users
>
>
More information about the pmwiki-users
mailing list