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

List of globals

Development and Programming

mweichert's avatar
mweichert
68 posts
17 years ago
mweichert's avatar mweichert

Hi,

is there a list of globals that are available when creating modules? I’ve found $DSP, $LANG, $TMPL, and $DB, but are there others?

Right now I’m most interesting in finding a variable that contains the ‘system root’. I need something like this to open and save files that are located in my module directory: DOCUMENT_ROOT/EE_ROOT/modules/[my_module_dir]

Thanks, Mike

[Mod Edit: Moved to the Modules: Technical Assistance forum]

       
Ingmar Greil's avatar
Ingmar Greil
29,243 posts
17 years ago
Ingmar Greil's avatar Ingmar Greil

Mike, these are all EE classes. You can read about them in the docs. In your case $PREFS->ini(‘system_folder’) might help.

       
mweichert's avatar
mweichert
68 posts
17 years ago
mweichert's avatar mweichert
Mike, these are all EE classes. You can read about them in the docs. In your case $PREFS->ini(‘system_folder’) might help.

Thanks for the reply Ingmar. Do you have an exact url that lists the different variables? The page you referred me to lists some of the classes for these globals, and I was able to guess that the Input class related to the $IN variable, but what class on that page relates to the $PREFS variable?

I have yet to find a page that lists all of the global variables available to me when developing a module.

Thanks again for your help.

Cheers, Mike

       
mweichert's avatar
mweichert
68 posts
17 years ago
mweichert's avatar mweichert

Unfortunately, $PREFS->ini(‘system_folder’) produced:

Notice: Undefined property: Preferences::$ini

Mike

       
mweichert's avatar
mweichert
68 posts
17 years ago
mweichert's avatar mweichert

Aha, it’s $PREFS->core-ini[‘system_folder’]

happy dance

Mike

       
Ingmar Greil's avatar
Ingmar Greil
29,243 posts
17 years ago
Ingmar Greil's avatar Ingmar Greil

Sorry, that must’ve change at some point. It’s $PREFS->core_ini[‘system_folder’] now. Try var_dump($PREFS) for a complete list.

       
Justin Hurlburt's avatar
Justin Hurlburt
344 posts
17 years ago
Justin Hurlburt's avatar Justin Hurlburt

please ignore this post

Greetings Mike,

From the error it appears you may have typed

$PREFS->$ini('system_folder');

Should be:

$PREFS->ini('system_folder');
       
mweichert's avatar
mweichert
68 posts
17 years ago
mweichert's avatar mweichert

Hmm, still can’t get things to work.

I’m using apache’s mod_userdir, so I couldn’t use the $_SERVER[‘DOCUMENT_ROOT’] in combination with the $PREFS global information to get the correct path.

I ended up making a system call, pwd which produces

/home/mweichert/public_html/ee/system

That’s perfect, and just what I was after - but I still cannot open or write a file within my modules folder. For example:

$my_module_path = trim(`pwd`).'/sphinx';
$base = file_get_contents($my_module_path.'/default.base');

produces:

Warning: file_get_contents(/home/mweichert/public_html/ee/system/sphinx/default.base) [function.file-get-contents]: failed to open stream: No such file or directory in /home/mweichert/public_html/ee/system/modules/sphinx/mcp.sphinx.php on line 152

I appreciate your help guys.

Mike

       
Ingmar Greil's avatar
Ingmar Greil
29,243 posts
17 years ago
Ingmar Greil's avatar Ingmar Greil
I’m using apache’s mod_userdir, so I couldn’t use the $_SERVER[‘DOCUMENT_ROOT’] in combination with the $PREFS global information to get the correct path.

I don’t know about mod_userdir, but personally I’d use $IN->GBL(‘DOCUMENT_ROOT’, ‘SERVER’);

       

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.