Jump to content

Recommended Posts

Posted

How do I get the directory of my module? I've checked my code and the cwd is the templates directory. One of my modules refers to the site modules but of course you can install into the core as well. I want to be able to load a file from within the module to process but I can't seem to figure out how to get the directory my module is installed into.

Posted (edited)
$config->urls->MyModuleClassName;

echoing that would return: /site/modules/MyModuleClassName/

http://processwire.com/api/variables/config/

or if you want the URL to your site modules directory.

$config->urls->siteModules

...and concatenate as you wish...

Change 'urls' to 'paths' if it is the absolute path you want...

Edited by kongondo
  • Like 5

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...