Note: The recipes here are for PmWiki versions 0.6 and 1.0 only. For PmWiki 2.0 recipes, see Cookbook.


Sometimes a WikiWord just appears too often on a page and I don't want every occurrence converted to a link. How can I limit the number of times a WikiWord is turned into a link?

Answer 1: Limiting all WikiWords

The number of times that WikiWords are converted to links is controlled by the $WikiWordCountMax variable. Thus, setting

    $WikiWordCountMax = 5;

in local/config.php or a PerGroupCustomization file will cause only the first five occurrences of each WikiWord to be converted to a link. Setting $WikiWordCountMax to 1 causes only the first occurrence of each WikiWord to become a link, and setting $WikiWordCountMax to zero effectively disables wiki words.

Note that this setting only affects "bare" WikiWords -- those that are group qualified or part of free links? still become links to the corresponding page.

Answer 2: Limiting selected WikiWords

One can also use the $WikiWordCount array to limit WikiWord conversions on a per-word basis. For example, PmWiki has a default setting of

    $WikiWordCount["PmWiki"] = 1;

to prevent "PmWiki" from being converted to a link more than once on a page. (It does occur a lot in the documentation you know.) You can add your own settings to this array for other WikiWords:

    ## only convert the first five occurrences of WikiWikiWeb
    $WikiWordCount["WikiWikiWeb"] = 5;

The $WikiWordCount array settings take precedence over $WikiWordCountMax.

See also

pmwiki-2.2.138 -- Last modified by {{simon}}

from IP: ip should be disabled by default for security reasons