11
Dave_L
Re: Need some pointers on $xoopsModule and $xoopsModuleConfig
  • 2004/12/21 13:31

  • Dave_L

  • XOOPS is my life!

  • Posts: 2277

  • Since: 2003/11/7


Well, that test file doesn't work because it's not part of a module. Since no module is active, that variable is not defined.

Try putting the file in the module's directory (if it isn't), and put this minimal content in it:

<?php

error_reporting
(E_ALL); #*#DEBUG#

include '../../mainfile.php';
include_once 
XOOPS_ROOT_PATH '/header.php';

var_dump('xoopsModuleConfig'$xoopsModuleConfig); #*#DEBUG#

include_once XOOPS_ROOT_PATH '/footer.php';

?>

12
ralf57
Re: Need some pointers on $xoopsModule and $xoopsModuleConfig
  • 2004/12/21 15:11

  • ralf57

  • Quite a regular

  • Posts: 231

  • Since: 2003/2/3 1


Ok dave,
i have put the code you provided into the root of my module (fckeditor,a port i'm doing) and got this result.
string(17"xoopsModuleConfig" array(2) { ["fck_uploads_dir"]=>  string(7"uploads" ["fck_all_ext_files"]=>  string(91""zip","doc","xls","pdf","rtf","csv","jpg","gif","jpeg","png","avi","mpg","mpeg","swf","fla"" }

It seems to correctly retrieve the config options,right?
But now 2 questions:
1)how can i "extract" these values?
2)i have to use these config values in a page that will not be shown but only used as config file.
I hope i was clear.

13
Dave_L
Re: Need some pointers on $xoopsModule and $xoopsModuleConfig
  • 2004/12/21 15:41

  • Dave_L

  • XOOPS is my life!

  • Posts: 2277

  • Since: 2003/11/7


That looks correct.

1) You could do this (if it's in the module itself, and not in a block):

$fck_uploads_dir $xoopsModuleConfig['fck_uploads_dir'];
echo 
'I am $fck_uploads_dir, the uploads directory!!!';


Or you could use Mithrandir's function (which will work both in the module itself and within a block):

$fck_uploads_dir getConfigValue('fck_uploads_dir');
echo 
'I am $fck_uploads_dir, the uploads directory!!!';


If you use that function, I suggest adding before the return:

isset($config[$config_name]) or trigger_error("'$config_name' not found"E_USER_ERROR);


2) I don't understand.

14
ralf57
Re: Need some pointers on $xoopsModule and $xoopsModuleConfig
  • 2004/12/21 15:57

  • ralf57

  • Quite a regular

  • Posts: 231

  • Since: 2003/2/3 1


I'll try and let you know...
Thanks again.

15
ralf57
Re: Need some pointers on $xoopsModule and $xoopsModuleConfig
  • 2004/12/21 16:45

  • ralf57

  • Quite a regular

  • Posts: 231

  • Since: 2003/2/3 1


Updates:
i've tried with this code,as you suggested
<?php

error_reporting
(E_ALL); #*#DEBUG#

include '../../mainfile.php';
include_once 
XOOPS_ROOT_PATH '/header.php';

var_dump('xoopsModuleConfig'$xoopsModuleConfig); #*#DEBUG#

echo '<br /><br />';

$fck_uploads_dir $xoopsModuleConfig['fck_uploads_dir'];

echo 
'I am $fck_uploads_dir, the uploads directory!!!';

include_once 
XOOPS_ROOT_PATH '/footer.php';

?>


but had this result (the variable doesn't get the value):

string(17"xoopsModuleConfig" array(2) { ["fck_uploads_dir"]=>  string(7"uploads" ["fck_all_ext_files"]=>  string(91""zip","doc","xls","pdf","rtf","csv","jpg","gif","jpeg","png","avi","mpg","mpeg","swf","fla"" }

I am $fck_uploads_dirthe uploads directory!!!


I've also tried to place this file (testconfig.php9 into the root of "news" module (replacing fck_uploads_dir with one of the news config options,of course) and had the same result.
What else can i try?

16
Dave_L
Re: Need some pointers on $xoopsModule and $xoopsModuleConfig
  • 2004/12/21 17:04

  • Dave_L

  • XOOPS is my life!

  • Posts: 2277

  • Since: 2003/11/7


That was my fault.

That expression should use double quotes, so that the variable will get interpreted:

echo "I am $fck_uploads_dir, the uploads directory!!!";

17
ralf57
Re: Need some pointers on $xoopsModule and $xoopsModuleConfig
  • 2004/12/21 18:07

  • ralf57

  • Quite a regular

  • Posts: 231

  • Since: 2003/2/3 1


Ok,this did the trick.
Now i have to test it with my code and
let you know.

Login

Who's Online

226 user(s) are online (152 user(s) are browsing Support Forums)


Members: 0


Guests: 226


more...

Donat-O-Meter

Stats
Goal: $100.00
Due Date: Apr 30
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits