1
fragttdg
Seeking hint for Config Settings in xoops_version
  • 2004/6/13 22:50

  • fragttdg

  • Just popping in

  • Posts: 34

  • Since: 2004/6/13


Hi all. I am trying to develop my first module in XOOPS and have encounted some questions in using xoops_version.php.
Below is part of my config setting:
....
$modversion['config'][2]['name'] = 'test_status';
$modversion['config'][2]['title'] = 'test_status';
$modversion['config'][2]['description'] = '';
$modversion['config'][2]['formtype'] = 'select';
$modversion['config'][2]['valuetype'] = 'text';
$modversion['config'][2]['default'] = 'status1';
$modversion['config'][2]['options'] = array(1 => 'status1', 2 => 'status2', 3 => 'status3');
...

Now I have no idea how to get my options array out. . I noticed there is a similar setting in News modules($modversion['config'][1]['options'] in News modules' xoops_version.php), but failed to find out where this setting is used. could someone give me a hint for this? thanks in advance. PS: sorry for my English.

2
Dave_L
Re: Seeking hint for Config Settings in xoops_version
  • 2004/6/13 23:02

  • Dave_L

  • XOOPS is my life!

  • Posts: 2277

  • Since: 2003/11/7


global $xoopsModuleConfig; // needed if in a function

echo "Hi there, I am test_status, and my value is {$xoopsModuleConfig['test_status']}!";

3
fragttdg
Re: Seeking hint for Config Settings in xoops_version
  • 2004/6/13 23:10

  • fragttdg

  • Just popping in

  • Posts: 34

  • Since: 2004/6/13


hi. thanks for your reply.
Is that to get the default value? I want to get the options array out. I tried $xoopsModuleConfig['test_status']['options'], but nothing happens.
Thanks again, hope to get further advice from you.

4
Dave_L
Re: Seeking hint for Config Settings in xoops_version
  • 2004/6/13 23:23

  • Dave_L

  • XOOPS is my life!

  • Posts: 2277

  • Since: 2003/11/7


$xoopsModuleConfig['foo'] is the current value of the option named 'foo'.

The value is selected via the preferences form on the module's admin page, which is automatically generated by XOOPS using the data in xoops_version.php.

The other information is normally not needed within a module's code, and I don't know if it's easily available.

5
Diabl0
Re: Seeking hint for Config Settings in xoops_version
  • 2004/7/20 12:31

  • Diabl0

  • Just popping in

  • Posts: 11

  • Since: 2004/7/3 1


Can you present more complex example. Coz i have done everything like was writen before:

in xoops_version.php:
Quote:
$modversion['config'][] = array(
'name' => 'test' ,
'title' => 'test value' ,
'description' => 'test desc' ,
'formtype' => 'textbox' ,
'valuetype' => 'text' ,
'default' => "2760" ,
'options' => array()
) ;


And in admin file:
Quote:
global $xoopsModuleConfig; // needed if in a function

echo "Hi there, I am test, and my value is {$xoopsModuleConfig['test']}!";


and i don't get my 'test' default value set in xoops_version.php
return is:
Quote:
Hi there, I am test, and my value is !


WTF is wrong?

And when/where will be some good complex MODDev API? This on http://wiki.xoops.org/wakka.php?wakka=XoopsModuleDoc is very simple and short, not presenting any more complicated situatins and examples.

6
Mithrandir
Re: Seeking hint for Config Settings in xoops_version

First off, you shouldn't set 'options' for a non-select type configuration item.

Secondly, have you gone to your module's administration -> preferences and set a value? (I know that it should by default be "2760" but something else may be wrong, which is perhaps revealed by going to set the preference with PHP debugging enabled)

Also, dev.xoops.org is the place to go for development - we are continously working on expanding the Dev wiki with more detailed information than what is suitable for wiki.xoops.org, which is meant for the simple overview.

7
Diabl0
Re: Seeking hint for Config Settings in xoops_version
  • 2004/7/20 13:45

  • Diabl0

  • Just popping in

  • Posts: 11

  • Since: 2004/7/3 1


Ok. I got my config value accesible in module pages, but still can't access it from module admin pages. Maybe there is other way to get this config values from module admin level?

8
Mithrandir
Re: Seeking hint for Config Settings in xoops_version

How does your admin page look like? (just the first 20-30 lines, please)

9
Diabl0
Re: Seeking hint for Config Settings in xoops_version
  • 2004/7/20 14:07

  • Diabl0

  • Just popping in

  • Posts: 11

  • Since: 2004/7/3 1


Quote:
include "../../../mainfile.php";
include XOOPS_ROOT_PATH."/include/cp_functions.php";
include_once XOOPS_ROOT_PATH."/class/xoopsmodule.php";
include_once XOOPS_ROOT_PATH."/class/xoopstree.php";

if (is_object($xoopsUser)) {
$xoopsModule =& XoopsModule::getByDirname("informatory");
if ( !$xoopsUser->isAdmin($xoopsModule->mid()) ) {
redirect_header(XOOPS_URL."/",3,_NOPERM);
exit();
}
$admintest=1;
} else {
redirect_header(XOOPS_URL."/",3,_NOPERM);
exit();
}

10
Mithrandir
Re: Seeking hint for Config Settings in xoops_version

Replace with
include '../../../include/cp_header.php';
xoops_cp_header();

//module admin code

xoops_cp_footer();

Login

Who's Online

276 user(s) are online (175 user(s) are browsing Support Forums)


Members: 0


Guests: 276


more...

Donat-O-Meter

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

Latest GitHub Commits