[dokuwiki] Re: DOKU_BASE

Oliver Geisen wrote:
Hi,

I'm having a hard time to access the site wide variables in an admin plugin.
How do you access them? Please give an example.

DOKU_BASE is a defined constant, so just use DOKU_BASE.

for global variables you must have a global declaration. The plugin scripts are included from within a function. As I understand it that means none of the script is in global scope, so even if you attempt to access DokuWiki globals outside any class or function block, you are still not in global scope.

e.g. global $ID;

For some examples take a look at the admin plugins included with DokuWiki. All of them will references the defines DOKU_INC and DOKU_PLUGIN. Most will references DOKU_CONF.

DOKU_BASE is the base URL for the DokuWiki installation. Do you need to access it?
To generate links you should be using the standardised dokuwiki functions:
- wl(), html_wikilink(), etc
These will take into account config settings and any other DokuWiki requirements, and will also be upgraded if those settings or requirements change.


Cheers,

Chris
--
DokuWiki mailing list - more info at
http://wiki.splitbrain.org/wiki:mailinglist

Other related posts: