PageListPlus
Questions answered by this recipe
- How can I group the results of different pagelists into a single formatted pagelist?
- How can I get better link capabilities in pagelists?
Description
Provide extensions to pagelist including linkto=x and parenthetical groupings with set operators.
Installation
- Download fpltemplate2.phpΔ and pagelist2.phpΔ and place them in your cookbook directory.
- Place these lines in your config.php:
$EnablePageList = 0; include_once("$FarmD/cookbook/fpltemplate2.php"); include_once("$FarmD/cookbook/pagelist2.php");
- Note that the order of those lines is very important -- don't put fpltemplate2 after pagelist2!
Notes
Parenthetical grouping of pagelists with set operators
By placing page selection criteria within parentheses you can combine sets of pages with set operators for union, intersection, and negation.
(:pagelist (link=Category.A) (link=Category.B):)
- Any pages with links to BOTH !A and !B
(:pagelist (link=Category.A),(link=Category.B):)
- Any pages with links to EITHER !A or !B
(:pagelist (link=Category.A) -(link=Category.B):)
- Any pages with links to !A and does NOT have a link to !B
(:pagelist (group=Test),(name=Xyz,Abc):)
- Any pages EITHER in the group Test OR pages in any group named Xyz or Abc
Any page selection criteria can be placed within the parentheses. If you want order, fmt, etc then put that outside the inner parentheses. Note that if you use inner parentheses then no page selection criteria outside of the inner parentheses will be used -- they will simply be ignored.
Note that theoretically parentheses can be nested to any reasonable depth, but I haven't tested the nested side of things much.
- Operators between parentheses
- A space or nothing or ^ acts as "and" (array_intersect())
- Comma or vertical bar or + acts as "or" (array_merge())
- Minus or bang acts as "and not" (array_diff())
This is purely experimental! I'll be very up front about the fact that I haven't hardly begun testing this. More of a proof of concept than anything really experimental.
linkto=x option
Additionally a linkto=x feature has been implemented which supports the following:
- linkto=x - identical to current link=x
- linkto=x,y - page contains links to EITHER x OR y
- linkto=a,b,^c - page contains links to EITHER a OR b but MUST contain also a link to c
- linkto=a,b,-c - page contains links to EITHER a OR b but MUST NOT contain a link to c
This linkto=x option is on the roadmap for a future version of core and I'm sure it will be implemented much more elegantly and optimized than this one. But if you need the capability today, this is available.
"or" capabilities on straight search terms
Any straight search terms combined with a comma will be treated as OR'd.
(:pagelist foo bar:)
- normal capability - both foo and bar must appear on a page for it to be included(:pagelist foo,bar:)
- new capability - page will be included if EITHER foo OR bar appear on it
Demo
This recipe has a live demo/test available at http://pmwiki.qdk.org/pmwiki.php/PageListPlus/PageList and other pages on that site.
Release Notes
- 2009-03-17 Initial pre-release with nested parentheses for groups and linkto=x,y functionality
See Also
Contributors
- This recipe is built on the capabilities of FPLTemplate by Hans
Comments
See discussion at PageListPlus-Talk?
User notes -1: 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.