[dokuwiki] Re: Can someone point me at the code change which allows paramters in internal links

  • From: Chris G <cl@xxxxxxxx>
  • To: dokuwiki@xxxxxxxxxxxxx
  • Date: Sun, 19 Dec 2010 17:33:11 +0000

On Sun, Dec 19, 2010 at 05:27:12PM +0000, Chris G wrote:
> On Sun, Dec 19, 2010 at 04:22:24PM +0000, Chris G wrote:
> > I can find the following under the Anteater release changes:-
> > 
> >     Parameters can now be passed in internal links (useful for plugins)
> > 
> > and (as you know) I'm using this.  However I need to make internal
> > links generated by the database2 plugin work the same way and currently
> > they don't.
> > 
> > I've searched on the GitHub Repository Browser to find the code changes
> > needed to do this (I'd like to see how it's done and do the same in
> > database2) but I can't find them.  I searched for 'Parameters' in the
> > change list there back to the start of 2010 but found nothing.
> > 
> > Can someone possibly point me at the code changes that did this?
> > 
> It's OK, I've found it, it's in the internallink() function in
> inc/parser/xhtml.php.  The links created by database2 do call this
> function but there's a previous call (to resolve_pageid()) which
> effectively removes the parameters by changing all the non-alpha
> characters to underscores.
> 
> I've commented out the resolve_pageid() call and everything seems to
> work perfectly now, I'm not quite sure what it was supposed to be doing,
> maybe I'll find out.  However for now everything is working perfectly
> and I can get back to collecting and massaging data rather than
> programming Dokuwiki.  :-)  
> 
... removing the call to resolve_pageid() in the database2 plugin *is* correct.
It used to do:-

                else
                {
                        // embed internal link in header
                        resolve_pageid( getNS( self::getPageID() ), &$href, 
&$exists );
                        $label = $this->renderer->internallink( $href, $label, 
NULL, true );
                }

However $this->renderer->internallink() itself calls resolve_pageid()
immediately after extracting the link parameters so the above call to
resolve_pageid() is redundant.

(Was this changed in internallink() when the ability to have link
parameters was added?)

-- 
Chris Green
-- 
DokuWiki mailing list - more info at
http://www.dokuwiki.org/mailinglist

Other related posts: