1
MIchaelMcA
Dynamically retreive module directory name
  • 2005/11/13 9:21

  • MIchaelMcA

  • Just popping in

  • Posts: 13

  • Since: 2005/5/1 1


Hi there,

Can you tell me how to dynamically retreive the current module's directory in code on a module page? $xoopsModule->getvar('dirname ') isn't working for me.

I want to retrieve it like this to save me work if I decide to rename the modules directory name duiring or after development.

I can't see any examples in other modules that do this, which suprised me. It made me think that maybe it's not a good idea to do it. Either that or I'm not looking hard enough . If it isn't a good idea, I wonder if you could tell me why?

I'm using XOOPS 2.0.13

Thanks a lot!

Michael

2
wtravel
Re: Dynamically retreive module directory name

Quote:
$xoopsModule->getvar('dirname ')
Probably you removed the space after dirname in your real code. Otherwise it would not be working indeed. If you use it within a function, you need to declare $xoopsModule global. So in the beginning of the function use:

global $xoopsModule;

Other than that, if you added the normal header lines on top of the page, I cannot see why it is not working unless you send me an example