[dokuwiki] Re: Current page id in sidebar

  • From: Michael Hamann <michael@xxxxxxxxxxxxxxxx>
  • To: dokuwiki@xxxxxxxxxxxxx
  • Date: Sun, 29 Jan 2012 23:18:19 +0100


On Sun, Jan 29, 2012 at 10:53 PM, Dennis Plöger <develop@xxxxxxxxxxxxxx> wrote:
>> Yes, according to [1] $INFO['id'] should always be the "main" page.
> Yes. That works. Hmm. Is this a bug? Should I file it?

I'm not sure what should be a bug here. This behavior is completely
intended and does also make sense in my opinion. The current page is
$ID, $INFO contains information about the global request. The problem
is that pages need to be rendered in different contexts (e.g. also for
getting meta data from another page) but different part of the code
need to know which page is currently rendered, e.g. in order to
correctly resolve internal links, read/write special meta data files
(discussion plugin, tag plugin, ...) etc. However there is
unfortunately no way in DokuWiki to access the name of the currently
rendered page but using $ID. That's why before a page is rendered the
global $ID is changed to the id of the page that is rendered. I'm not
completely sure, but I think in most cases it is also done for the
handler (I'm also speaking of plugins like blogtng or include). I'm
very much in favor of getting rid of these globals in as many places
as possible and make things like the currently rendered page available
in other ways, e.g. as attribute of the renderer or handler, but I
fear this will be a complicated transition. I think the problem is
that this design is deeply rooted in DokuWiki and it won't be easy to
change it and from all I know it is usually not that problematic once
you are aware of this design as simply changing $ID is enough.

DokuWiki mailing list - more info at

Other related posts: