2
I think that a workaround would be to disable certain blocks from your module code if you do not want them displayed even when they belong to your module. After the page has been rendered you could enable the block again so that it is displayed normally again within modules.
This would involve looking up the block's bid in the xoops_newblocks table.
I whipped up this bit of code. Haven't tested it at all so I hope that it works:
<?php
/**
* Functions to temporarily hide or show certain blocks so they can be
* made to be visible in some pages of a module instead of all
*
* Invoke disableBlock before including header.php in a module
* Invoke enableBlock after including footerphp in a module
* @author Dirk Louwers <dirk,louwers@symtech.nl>
* @copyright (c) 2005 Dirk Louwers
* @example
* (...)
* disableBlock(12, true);
* include('../../header.php');
* (...)
* include('../../footer.php');
* enableBlock(12, true);
* (...)
*/
/**
* Disables a block by making it invisible
* @param int $blockid
* @param bool $force set to true if you have any GET variables
* in the page request
* @return false on error, else true
*/
// public
function disableBlock($blockid, $force=false)
{
global $xoopsDB;
if(intval($blockid > 0))
{
$sql = 'Update '.$xoopsDB->prefix('newblocks').' Set visible=0'
.' Where bid='.intval($blockid);
if($force) {
$result = $xoopsDB->queryF($sql);
}
else {
$result = $xoopsDB->query($sql);
}
if(!$result) return false;
return true;
}
return false;
}
/**
* Enables a block by making it visible
* @param int $blockid
* @param bool $force set to true if you have any GET variables
* in the page request
* @return false on error, else true
*/
// public
function enableBlock($blockid, $force=false)
{
global $xoopsDB;
if(intval($blockid > 0))
{
$sql = 'Update '.$xoopsDB->prefix('newblocks').' Set visible=1'
.' Where bid='.intval($blockid);
if($force) {
$result = $xoopsDB->queryF($sql);
}
else {
$result = $xoopsDB->query($sql);
}
if(!$result) return false;
return true;
}
return false;
}
?>
.