1
unlucky
Modversion Config Problem
  • 2006/5/11 15:22

  • unlucky

  • Just popping in

  • Posts: 26

  • Since: 2005/8/26


Hello,

I have scoured the forums and hopefully I didnt overlook anything that addresses this issue, so I am going to ask it.

I am having problems with a module I am writing. I have tried to add a config section to my xoops_version file. This is what my entry looks like:

$modversion['config'][1]['name']='headshot_dir';
$modversion['config'][1]['title']='_MI_ERUD_HSPATH_TITLE';
$modversion['config'][1]['description']='_MI_ERUD_HSPATH_DESC';
$modversion['config'][1]['formtype']='textbox';
$modversion['config'][1]['valuetype']='text';
$modversion['config'][1]['default'] = 'dir/';


All I want it to do is allow for a way to set a default directory.

Now, there are two problems related to this. First of all, the default value is never there. I have tried all sorts of variations, using double quotes, defining a value in the modinfo.php, etc. But no matter what I do, for some reason, it will not ever set the default option.

And the second problem is that the link to get to this preference file does not show up under System->Preferences like I expect it to. I have to manually change the URL to get to it.

The title and description both show up just fine, and the preferences page looks fine, when I manually type in the URL. But there is no link, and it wont show my default value.

Any ideas?

2
m0nty
Re: Modversion Config Problem
  • 2006/5/11 15:35

  • m0nty

  • XOOPS is my life!

  • Posts: 3337

  • Since: 2003/10/24


have you included this in the xoops_version.php

// Admin things
$modversion['hasAdmin'] = 1;
$modversion['adminindex'] = "admin/index.php";
$modversion['adminmenu'] = "admin/menu.php";


hasadmin, will enable it.
the others are the path to the admin index page and menu etc.

also do you need the trailing slash?

a better method of doing the modversion configs is to use an array aswell.

$modversion['config'][] = array(
    
'name'             => 'headshot_dir',
    
'title'         => '_MI_ERUD_HSPATH_TITLE',
    
'description'     => '_MI_ERUD_HSPATH_DESC',
    
'formtype'         => 'textbox',
    
'valuetype'     => 'text',
    
'default'         => 'dir/');


by using the array, you don't need to worry about the [1] numbers etc for positioning the field in the preferences, the fields will always be displayed in the order of each array.

also note, once you have installed the module, and the values are set, updating the module again will not change the default value if it was changed in xoops_version.php, the default value is only set when the module is 1st installed.. once the config table has that data, it doesn't change it again unless you change it in preferences manually..

3
Dave_L
Re: Modversion Config Problem
  • 2006/5/11 15:42

  • Dave_L

  • XOOPS is my life!

  • Posts: 2277

  • Since: 2003/11/7


The stuff you posted looks ok.

To get the default value to show up, you may have to uninstall/reinstall the module. The reason for that is that updating a module doesn't affect existing configuration settings. But there's no need to do that unless you just want to test that feature.

I'm not sure why the link doesn't show up. That may also require reinstalling the module, if $modversion['config'] wasn't present when you originally installed it.

You didn't say which version you're using. In XOOPS 2.2.x, if you want a link to the module's preferences on the module's admin index page, or in the module's admin popup menu, you have to add those yourself. But the links under Preferences on the top bar should get generated automatically. I don't remember exactly how that works in 2.0.x.

----
edit

m0nty's reply looks better than mine, but I'll leave it here anyway.

4
unlucky
Re: Modversion Config Problem
  • 2006/5/11 15:58

  • unlucky

  • Just popping in

  • Posts: 26

  • Since: 2005/8/26


Semi-related question... is it possible to have a preferences page (System->Preferences->"Module Name" Preferences) without having an admin page?

I dont have any admin pages, and as of now, I dont have anything that needs them. I just have a few preferences I want set.

I added this:
// Admin things
$modversion['hasAdmin'] = 1;
$modversion['adminindex'] = "admin/index.php";
$modversion['adminmenu'] = "admin/menu.php";


but that didnt help with the preferences thing. I am thinking that since I have no admin section, the admin index and menu arent necessary. But can I still do preferences?

5
m0nty
Re: Modversion Config Problem
  • 2006/5/11 16:02

  • m0nty

  • XOOPS is my life!

  • Posts: 3337

  • Since: 2003/10/24


should think so.

altho i think menu is needed so you can get to preferences.

have you tried uninstalling the module, and then reinstalling? the default value should be set then..

6
unlucky
Re: Modversion Config Problem
  • 2006/5/11 16:20

  • unlucky

  • Just popping in

  • Posts: 26

  • Since: 2005/8/26


Alright, I took out the references to adminIndex and adminMenu, and I uninstalled the module. I then reinstalled the module, and it shows up in preferences, and it has a default value.

Thanks for all your help!

Login

Who's Online

403 user(s) are online (145 user(s) are browsing Support Forums)


Members: 0


Guests: 403


more...

Donat-O-Meter

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

Latest GitHub Commits