<html>
<head>
<style>
P
{
margin:0px;
padding:0px
}
body
{
FONT-SIZE: 10pt;
FONT-FAMILY:Tahoma
}
</style>
</head>
<body>
<br><br>> Date: Mon, 2 Apr 2007 12:29:23 -0500<br>> Subject: Re: [pmwiki-users] categories in pagelist<br>> <br>> On Mon, Apr 02, 2007 at 04:35:38PM +0000, J. Meijer wrote:<br>> > On 4/1/07, Petko Yotov <5ko@free.fr> wrote:<br>> > Currently we can not search for more than one page in the "link="<br>> > parameter,<br>> > so in the third example "link=Cat1,Cat2" is just ignored. It would be<br>> > really<br>> > nice though, Patrick, if that became possible (also with<br>> > negatives "link=Cat1,-Cat2").<br>> <br>> Just checking... do you want "link=Cat1,Cat2" to mean "all pages with <br>> links to either Cat1 or Cat2" or "all pages with links to both Cat1 and Cat2"?<br>> <br>> > Petko, you can have multiple links matched in pagelists, if you're willing<br>> > to patch function PageListTermsTargets() in pagelist.php:<br>> > [...]<br>> > if (@$opt['link']) { #!# JM-mod<br>> > if(!is_array($opt['link']))<br>> > $opt['link']=explode(',',$opt['link']);<br>> > $link=array();<br>> > foreach($opt['link'] as $l) {<br>> > $link[] = MakePageName($pn, $l);<br>> > $indexterms[] = " $l ";<br>> > }<br>> > $opt['=linkp'][] = "/(^|,)".implode('|',$link)."(,|$)/i";<br>> > }<br>> > <br>> > I believe this can be turned into a recipy after recent pagelist.php<br>> > refactorings.<br>> <br>> The above code won't work, as $opt['=linkp'] cannot be an array.<br>> Putting it as an array causes lots of "preg_match() expects parameter 1<br>> to be a string" errors from PHP.<br>> <br><br><br>That's correct, I forgot the second patch (it wasn't as clearly marked!):<br><br> case PAGELIST_ITEM:<br> if (!$page) { $page = ReadPage($pn, READPAGE_CURRENT); $opt['=readc']++; }<br> if (!$page) return 0;<br>## changed section:<br> if (@$opt['=linkp']) { <br> foreach($opt['=linkp'] as $l) <br> if(preg_match($l, @$page['targets'])) { $l=0; break; }<br> if($l) { # no link matched<br> $opt['=reindex'][] = $pn; return 0; }<br> }<br><br><br>> Removing the [] from the last line somewhat works -- but the code<br>> above displays only those pages with links to both Cat1 and Cat2 to be <br>> displayed. See the example using the above code (after fixing the [] error) <br>> at:<br>> <br>> http://www.pmichaud.com/sandbox/multilink/pmwiki.php?n=Main.HomePage<br>> <br>> So, if the intent is to find pages that are in all of the link= targets<br>> (i.e., the intersection and not the union), then the above will probably<br>> work for that. However, I know a lot of people will expect or want<br>> "link=Cat1,Cat2" to display pages having either Cat1 or Cat2 as targets.<br>> <br>> <br>> > I hope no recipy is need, but that this instead gets included into pmwiki.<br>> <br>> I'm planning to include this capability at some point, but I also want<br>> to be able to handle negatives and wildcards. There's also the issue<br>> that it needs to remain somewhat quick, which requires refactoring<br>> the pageindex a bit (which is why the patch proposed above gives the<br>> intersection instead of the union).<br><br>The link intersection is the highly desired capability needed to give me virtual hierarchy capability using categories. I was doing some experiments here. <br><br><br>I think that instead of the link=+xx and link=-yyy syntax there is the option to have this:<br><br> ## get a pages with xxx AND yyy (as I did implement):<br> (:pagelist link=xxx,yyy:)<br> ## get pages with xxx OR yyy:<br>
(:pagelist link=xxx link=yyy:)<br> ## get pages with xxx OR both yyy and zzz<br>
(:pagelist link=xxx link=yyy,zzz:)<br>
<br>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. <br><br><br>/jm<br><br>> <br>> Pm<br>> <br><br><br><br><br><br><br>ps On the topic of semantics Pm wrote<br><br><div style="direction: ltr;">> I think this is inconsistent with the other filters -- consider<br><br> 1. group=PmWiki,Site<br> 2. name=Test*,XYZ*<br> 3. $:Status=open,closed,pending<br><br>> We expect these to mean<br><br> 1. pages in either the PmWiki or Site groups<br> 2. pages that begin with either "Test" or "XYZ"<br> 3. pages with $:Status of open, closed, or pending<br><br>> Thus, to be consistent with the above, I would think that "link=Cat1,Cat2"<br>> should mean "pages with links to either Cat1 or Cat2".<br><br>It is this way because a group *can't* be 2 groups at a time. Likewise Name, likewise $:Status. <br><br></div><span class="q">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.. <br></span><br><br>---<br><br>I haven't thought any of the combinations through. It certainly will be yet another key capability to have. Thanks!<br><br><br><br><br><br /><hr />It’s tax season, make sure to follow these few simple tips <a href='http://articles.moneycentral.msn.com/Taxes/PreparationTips/PreparationTips.aspx?icid=WLMartagline' target='_new'>Check it out!</a></body>
</html>