Summary: Enable multiple pages and wildcards in PageList
The recipe enables multiple pages and wildcards by adding a links= option to the pagelist directive.
The recipe provides complex searches/pagelists for categories and backlinks.
Copy the file pagelistmultitargets.phpΔ (alt.download pagelistmultitargets.php) to your pmwiki/cookbook directory. Then add the following line to config.php:
In a wiki page use the new links= parameter, instead of the link= parameter, for multiple pages or wildcard lists.
- Use a comma between multiple targets.
- Use '+' or '-' to force or exclude targets
- If a target is preceded by '-' (minus), that target is excluded, so the pagelist will exclude all pages linked to that target.
- If a target is preceded by '+' (plus), that target is required.
- If some targets are not preceded by '+' or '-', then the pagelist will contain pages linked to at least one of these targets.
- You can use wildcards in the target names, with '*' meaning 'anything', for example "*.HomePage" or "Site.*".
Of course, you can use any other pagelist parameters like name, group, count, fmt, etc.
(:pagelist links=PmWiki.DocumentationIndex,PmWiki.BasicEditing:) will list pages linked to at least one among PmWiki.DocumentationIndex and PmWiki.BasicEditing.
(:pagelist links=+PmWiki.DocumentationIndex,+PmWiki.BasicEditing:) will list pages linked to BOTH page PmWiki.DocumentationIndex and PmWiki.BasicEditing.
(:pagelist links=PmWiki.DocumentationIndex,-PmWiki.BasicEditing:) will list pages linked to PmWiki.DocumentationIndex and NOT linked to PmWiki.BasicEditing.
(:pagelist links=-Category.*:) will list any pages that don't link to a page in the Category group.
(:pagelist links=Category.*,-Category.Category:) will list any pages that link to a page in the Category group, except those linked to Category.Category.
The recipe can "hijack" the original
link= parameter in PageLists, allowing multiple targets with
link= too. To enable this feature, add to config.php such a line:
$EnablePLMTLink = 1;
- If you need pages linked to a single target, using the core parameter "link=" will be slightly faster.
- The following are currently equivalent:
links=*.PagenameWithoutGroup (this may change in the future, don't rely on it.).
Change log / Release notes
- 20151222 Fix bug with $EnablePLMTLink.
- 20140312 Add $EnablePLMTLink.
- 20130415 Small logic/speed optimization; reindex pages that appear out of date in the .pageindex file.
- 20130414 First public release, ready to be tested.
- Recipe written and maintained by Petko (5ko [snail] 5ko [period] fr) based on code from pagelist.php by Pm.
- If this recipe helps you or saves you time, you can help support its continued development by ♥ .
See discussion at PageListMultiTargets-Talk
User notes +2: If you use, used or reviewed this recipe, you can add your name. These statistics appear in the Cookbook listings and will help newcomers browsing through the wiki.