finding backlinks (was: [Pmwiki-users] Organization of pages (was: Hierarchical groups))
Patrick R. Michaud
pmichaud
Mon Jun 14 09:30:36 CDT 2004
On Mon, Jun 14, 2004 at 04:57:54PM +0200, Thomas -Balu- Walter wrote:
> On Mon, Jun 14, 2004 at 08:10:25AM -0600, Patrick R. Michaud wrote:
> >
> > Right now it's a bit difficult to do in 1.0 because there are so many
> > link syntaxes, and some things that might look like links aren't links.
> > But in 2.0 it becomes much easier, because the only link syntaxes are
> > [[...]] and WikiWords.
>
> It might become easier, but you still have to watch for
> [[Linked (Page)]] [[Linked Page | go there]]
> so a simple search might not be "enough"
Oh, it's not nearly that bad. Here's the 2.0 code to find all of the
pages referenced by any sort of double-bracket link in a page's
markup text:
$list = array();
preg_match_all("/\\[\\[([^|\\]\\]+)(\\|.*?)?\\]\\]",$page['text'],$match);
foreach($match[1] as $m) {
$pn = MakeLink($pagename,$tgt,NULL,NULL,'$PageName');
if ($pn != '$PageName') $list[] = $pn;
}
At the end of this code, $list will be an array of all of the pages
that this page references using double-bracket links, regardless of
whether or not the bracket-text contains (), |, "...", ?action=..., etc.
> BTW - I want to update ;) - at which time do you think it will be
> "beta-stable"? (Yes, I know the CVS, but... ;)
I don't know when it will reach a beta-stable status, I'm hoping to be there
this week or next. I'll certainly be making "beta" releases (via tarballs
and CVS) before the code gets too much farther along--it's just not quite
there yet.
Pm
More information about the pmwiki-users
mailing list