[dokuwiki] Global vars within plugins...

  • From: "Terence J. Grant" <tjgrant@xxxxxxxxxxxx>
  • To: dokuwiki@xxxxxxxxxxxxx
  • Date: Mon, 28 Jul 2008 15:29:16 -0400

Hi all,

For a plugin, I'm looking to check the availability of an installed library.

The only way I've found I can do this (anyone know another way?) is to do this:

$libAvailable = (!@include_once("Lib/example.php")) ? false : true;

Now this of course works outside of the plugin class definitions,
however, I need to know from within a class method if it's available.

Strangely enough, I'd think that simply adding to the class method:

global $libAvailable;

...Would make this variable available from within the method, however
I find that this is not the case.

Now I could just simply say:

function html()
{
...
$libAvailable = (!@include_once("Lib/example.php")) ? false : true;
...
}

Much to my surprise, this works, however I would imagine this is the
worst possible thing you could do-- include a library from within the
scope of a class method, right?

Any ideas on how I can solve this problem? Or any alternatives to
check existence of a library?

Thanks,
-- 
--Terence J. Grant
-- 
DokuWiki mailing list - more info at
http://wiki.splitbrain.org/wiki:mailinglist

Other related posts: