Joined: 15 May 2007 |
Posts: 11 |
|
|
|
Posted: Wed Aug 29, 2007 11:47 am |
|
|
|
|
|
but you are all php debuggers, maybe you can help (I'm seeing this problem in my dbg session)
Using moodle, standard module require_once's a file config.php, which sets $CFG->somevars including $CFG->wwwroot, and then requires $CFG->wwwroot/lib/setup.php. In there, setup.php has a line
global $CFG.
Now, in normal use, this is ok, and $CFG keeps its values clean.
I'm adding a new module, so I include the same config.php as moodle does (cos I want some moodle setup info), and stepping thru, config.php does same stuff, setting up $CFG->vars. Lovely.
Then it require_once's $CFG->wwwroot/lib/setup.php, and the global $CFG line wipes out the contents of $CFG.
I can understand why it would, as the scoping of global says do this, but I cannot see why the original code would not.
Any ideas?
|
_________________ DS
|