1
RVirtue
$xoopsModuleConfig Value in Block
  • 2005/3/6 6:11

  • RVirtue

  • Quite a regular

  • Posts: 246

  • Since: 2004/8/4 9


Is it possible to get a value from $xoopsModuleConfig settings for use within a block? Doesn't seem to work for me.

I apologise in advance if I've missed a simple answer somewhere, but I can't seem to find one.

2
hyperpod
Re: $xoopsModuleConfig Value in Block
  • 2005/3/6 6:55

  • hyperpod

  • Quite a regular

  • Posts: 359

  • Since: 2004/10/4


This may work for you:

le="color: #000000"><?php $modhandler = &xoops_gethandler('module'); $xoopsModule = &$modhandler->getByDirname("moduledirname"); $config_handler = &xoops_gethandler('config'); $xoopsModuleConfig = &$config_handler->getConfigsByCat(0,$xoopsModule->getVar('mid')); $something = $xoopsModuleConfig['modconfigname'];



See if you can get this to work.


Best Regards,

3
Mithrandir
Re: $xoopsModuleConfig Value in Block

Or saving a query if you are in the desired module:

le="color: #000000"><?php if (!is_object($GLOBALS['xoopsModule'] || $GLOBALS['xoopsModule']->getVar('dirname') != "moduledirname") { $modhandler = &xoops_gethandler('module'); $module = &$modhandler->getByDirname("moduledirname"); $config_handler = &xoops_gethandler('config'); $moduleConfig = &$config_handler->getConfigsByCat(0,$module->getVar('mid')); } else { $moduleConfig =& $GLOBALS['xoopsModuleConfig']; } $something = $moduleConfig['modconfigname'];

4
RVirtue
Re: $xoopsModuleConfig Value in Block
  • 2005/3/6 16:12

  • RVirtue

  • Quite a regular

  • Posts: 246

  • Since: 2004/8/4 9


That works. Thanks very much to both.

[EDIT] Just in case this finds its way into anyone else's bag of tricks, there's a missing close bracket in the first line of Mith's modification. It should be
le="color: #000000"><?php if (!is_object($GLOBALS['xoopsModule']) || $GLOBALS['xoopsModule']->getVar('dirname') != "moduledirname") {
I'm happy to see that I'm not the only one who occasionally loses count of brackets and braces.

Login

Donat-O-Meter

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

Latest GitHub Commits