[pmwiki-users] categories in pagelist

Petko Yotov 5ko at free.fr
Mon Apr 2 13:55:35 CDT 2007


On Monday 02 April 2007 19:29, Patrick R. Michaud wrote:
> On Mon, Apr 02, 2007 at 04:35:38PM +0000, J. Meijer wrote:
> >    On 4/1/07, Petko Yotov <5ko at free.fr> wrote:
> >      Currently we can not search for more than one page in the "link="
> >      parameter,
> >      so in the third example "link=Cat1,Cat2" is just ignored. It would
> > be really
> >      nice though, Patrick, if that became possible (also with
> >      negatives "link=Cat1,-Cat2").
>
> Just checking...  do you want "link=Cat1,Cat2" to mean "all pages with
> links to either Cat1 or Cat2" or "all pages with links to both Cat1 and
> Cat2"?

Thanks Patrick. I always thought that this should behave like the word match 
filter, so, "link=Cat1,Cat2" to mean "all pages with links to both Cat1 and 
Cat2". I thought at one point that it may be possible to use "+Cat1" for 
required and "Cat1" for optional, but it brings more trouble than solutions.

>
> >    Petko, you can have multiple links matched in pagelists, if you're
> > willing to patch function PageListTermsTargets() in pagelist.php:
> >    [...]

Thanks J. Meijer, I actually wrote a similar modification a while ago (before 
PageTextVariables appeared) but thought it isn't worth it to patch it every 
time PmWiki evolves (and my other experience on proposing my patches to core 
was not encouraging). So I quickly decided to use the fulltext search, and to 
search for special keywords like this:
  (:pagelist _Cat1_ -_Cat2_:)

This is not as great and intuitive as with links but works.

I'm also using a custom function that calls MakePageList like this:

	$opt = array(
		'name'=>'Am*',
		'group'=>"-Site,-Templates,-Main,-$group",
		''=>"__{$group}__",
	);// pages that contain the current group name with __
	$tmp = MakePageList($pagename, $opt, 0);

and then does several array_diff() and array_intersect() with other arrays to 
obtain the desired results. One can merge/intersect two or more such arrays 
if needed:

	$tmp = MakePageList($pagename, $opt, 0);
	$tmp2 = MakePageList($pagename, $opt2, 0);

  For me what is absolutely essential is the speed of a pagelist,
  so I prefer to only use .pageindex and not open every file for
  inspection unless impossible (so: no PageTextVar search for now).

> >    I believe this can be turned into a recipy after recent pagelist.php
> >    refactorings.

Yes, or if it were possible to define custom parameters like:
  myfunction=something
like it is currently possible to have a "list=" and "order=" custom 
parameters.

Thanks,
Petko






More information about the pmwiki-users mailing list