1
DMarvelus
Modules as Components!!
  • 2005/10/7 13:53

  • DMarvelus

  • Just popping in

  • Posts: 70

  • Since: 2005/1/29


I would like to have some module metadata stored in xoops_config/xoops_configcategory

Basically, I just need one bit of information stored for now... Which is just whether the module supports displaying maps. I am working on some modules having to do with mapping locations.

I suppose it has something to do with putting data in xoops_config.

all the module would have to have for now is:

mapping=1 (or something similar)

From within another module, I would like to query the metadata... But, possibly, using some XOOPS API, rather than just using SQL.

Does any one know how this works? Could you let me know?

2
DMarvelus
Modules as Components!!
  • 2005/10/7 21:18

  • DMarvelus

  • Just popping in

  • Posts: 70

  • Since: 2005/1/29


I'm guessing by the lack of replies that this can't be done.

What I would like to do: My locations module can use one or more mapping modules, to display different types of maps. I would like to be able to choose, from the locations module control panel, which map module to use. The map modules are effectively libraries that can be installed and uninstalled.

What I would like to see is:

1. Modules to be able to save (arbitrary) metadata about their operation. and

2. modules to be able to be informed when other modules are either installed or uninstalled.

This would increase the ways the modules could work together, and therefore, increase the ways that module writers could collaborate.

just thought of another use... For example, an administrator could choose which rich text editor to use, out of many installed ones. Modules could basically be components. Like dlls, or shared libraries.


This would be a great addition, and i think it would contribute to the growth of Xoops.

3
rowdie
Re: Modules as Components!!
  • 2005/10/8 2:16

  • rowdie

  • Just can't stay away

  • Posts: 846

  • Since: 2004/7/21


To define module configs you need to use the $modversion['config'] variable in the xoops_version.php file of your module. For each config define the name, description, type and set a default value. If the type is 'select' it is also possible to define an array of selectable values.

The configs you define will show up in the module admin as module 'preferences'. The config definitions and values are stored in the [prefix]_config table.

Retrieving the config value
- from within the module:
use $xoopsModuleConfig['config_name']

- from within a function of the module:
first use global $xoopsModuleConfig

- from another module:
See the code snippet posted by Hervé on the dev.xoops.org site


See also the dev wiki page on xoopsModuleConfig

4
DMarvelus
Re: Modules as Components!!
  • 2005/10/8 11:09

  • DMarvelus

  • Just popping in

  • Posts: 70

  • Since: 2005/1/29


okay... sounds good...

On a more general level, I would still like to see a way to add module metadata, meaning data that is not meant to be configurable, but just to tell something about the module.

That way, it would be much easier to use a module as a library on top of which other modules could be built. It would also be easier to define relationships between the modules.

for example: i would like to be able to quickly find all modules where mapping is set to 1. I was just thinking about defining a config option that can't change, and adding an index to the config_name column of the config table. That would work for now...

I'm sure there are other examples of modules that use other modules too... This would just make it a lot easier and more organized.

Login

Who's Online

338 user(s) are online (259 user(s) are browsing Support Forums)


Members: 0


Guests: 338


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