We use cookies to improve your experience. No personal information is gathered and we don't serve ads. Cookies Policy.

ExpressionEngine Logo ExpressionEngine
Features Pricing Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University
Log In or Sign Up
Log In Sign Up
ExpressionEngine Logo
Features Pro new Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University Blog
  • Home
  • Forums

Accessing module from within extension

Development and Programming

Phoebe's avatar
Phoebe
58 posts
17 years ago
Phoebe's avatar Phoebe

I want to access a function in a custom module from within an extension. I can load it again but wondered if it is already loaded, and if so, how I can access it?

       
Jamie Poitra's avatar
Jamie Poitra
409 posts
17 years ago
Jamie Poitra's avatar Jamie Poitra

Phoebe,

Classes aren’t loaded unless you specially ask for them.

EE allows you to load a lot of commonly used ones like this:

global $DB, $SESS;

Otherwise you will want to call the class yourself within the function that needs it. EE does provide some ways to make this more reliable.

PATH_MOD will give you the full path to the modules directory for instance. So your extension will be able to find the correct full path to the module easily.

An example of calling a class from the Plugin directory can be seen in this thread. Doing it from a module would work very similarly except you would use PATH_MOD and a module name instead of PATH_PI and a plugin name.

Jamie

       

Reply

Sign In To Reply

ExpressionEngine Home Features Pro Contact Version Support
Learn Docs University Forums
Resources Support Add-Ons Partners Blog
Privacy Terms Trademark Use License

Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.