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]
Mike, these are all EE classes. You can read about them in the docs. In your case $PREFS->ini(‘system_folder’) might help.
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
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
Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.