> Date: Mon, 2 Apr 2007 12:29:23 -0500> Subject: Re: [pmwiki-users] categories
> in pagelist> > On Mon, Apr 02, 2007 at 04:35:38PM +0000, J. Meijer wrote:> >
> On 4/1/07, Petko Yotov <[EMAIL PROTECTED]> 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"?> > > Petko, you can have
> multiple links matched in pagelists, if you're willing> > to patch
> function PageListTermsTargets() in pagelist.php:> > [...]> > if
> (@$opt['link']) { #!# JM-mod> > if(!is_array($opt['link']))> >
> $opt['link']=explode(',',$opt['link']);> >
> $link=array();> > foreach($opt['link'] as $l) {> >
> $link[] = MakePageName($pn, $l);> > $indexterms[] = " $l ";> >
> }> > $opt['=linkp'][] =
> "/(^|,)".implode('|',$link)."(,|$)/i";> > }> > > > I believe this
> can be turned into a recipy after recent pagelist.php> > refactorings.> >
> The above code won't work, as $opt['=linkp'] cannot be an array.> Putting it
> as an array causes lots of "preg_match() expects parameter 1> to be a string"
> errors from PHP.> That's correct, I forgot the second patch (it wasn't as
> clearly marked!): case PAGELIST_ITEM: if (!$page) { $page =
> ReadPage($pn, READPAGE_CURRENT); $opt['=readc']++; } if (!$page) return
> 0;## changed section: if (@$opt['=linkp']) {
> foreach($opt['=linkp'] as $l) if(preg_match($l, @$page['targets']))
> { $l=0; break; } if($l) { # no link matched
> $opt['=reindex'][] = $pn; return 0; } }> Removing the [] from the last
> line somewhat works -- but the code> above displays only those pages with
> links to both Cat1 and Cat2 to be > displayed. See the example using the
> above code (after fixing the [] error) > at:> >
> http://www.pmichaud.com/sandbox/multilink/pmwiki.php?n=Main.HomePage> > So,
> if the intent is to find pages that are in all of the link= targets> (i.e.,
> the intersection and not the union), then the above will probably> work for
> that. However, I know a lot of people will expect or want> "link=Cat1,Cat2"
> to display pages having either Cat1 or Cat2 as targets.> > > > I hope no
> recipy is need, but that this instead gets included into pmwiki.> > I'm
> planning to include this capability at some point, but I also want> to be
> able to handle negatives and wildcards. There's also the issue> that it
> needs to remain somewhat quick, which requires refactoring> the pageindex a
> bit (which is why the patch proposed above gives the> intersection instead of
> the union).The link intersection is the highly desired capability needed to
> give me virtual hierarchy capability using categories. I was doing some
> experiments here. I think that instead of the link=+xx and link=-yyy syntax
> there is the option to have this: ## get a pages with xxx AND yyy (as I did
> implement): (:pagelist link=xxx,yyy:) ## get pages with xxx OR yyy:
(:pagelist link=xxx link=yyy:) ## get pages with xxx OR both yyy and zzz
(:pagelist link=xxx link=yyy,zzz:)
Don't know how this'll conflict with user expectations, but I find it quite
acceptable. Maybe you'd like interchange the and & or semantics. /jm> > Pm> ps
On the topic of semantics Pm wrote> I think this is inconsistent with the other
filters -- consider 1. group=PmWiki,Site 2. name=Test*,XYZ* 3.
$:Status=open,closed,pending> We expect these to mean 1. pages in either
the PmWiki or Site groups 2. pages that begin with either "Test" or "XYZ"
3. pages with $:Status of open, closed, or pending> Thus, to be consistent
with the above, I would think that "link=Cat1,Cat2"> should mean "pages with
links to either Cat1 or Cat2".It is this way because a group *can't* be 2
groups at a time. Likewise Name, likewise $:Status. But a page can easily have
several backlinks (meaning "on a certain domain"). I believe that is the real
application here. Those seeking this capability have expectancies that *may*
differ from the suggestion arising from the above presentation.. ---I haven't
thought any of the combinations through. It certainly will be yet another key
capability to have. Thanks!
_________________________________________________________________
It’s tax season, make sure to follow these few simple tips
http://articles.moneycentral.msn.com/Taxes/PreparationTips/PreparationTips.aspx?icid=WLMartagline
_______________________________________________
pmwiki-users mailing list
[email protected]
http://www.pmichaud.com/mailman/listinfo/pmwiki-users