hi.
It is good idea to divide blockinstance from newblocks.
And it is good idea too, to assign not only `title` and `content` but also `id`(=instanceid),`typeid`(=bid),`weight`.
But typeid(=bid) is never assigned in XOOPS 2.2.1.
This is a typo in end of kernel/blockinstance.php
while ( $myrow = $this->db->fetchArray($result) ) {
$newblock = false;
if (!isset($blocks[$myrow['bid']])) {
$blocks[$myrow['bid']] =& $block_handler->create(false);
$newblock = true;
}
$instance =& $this->create(false);
$instance_vars = array_keys($instance->getVars());
foreach ($myrow as $key => $value) {
if ($newblock && !in_array($key, $instance_vars)) {
$blocks[$myrow['bid']]->assignVar($key, $value);
}
else {
$instance->assignVar($key, $value);
}
}
[color=ff0000] $blocks[$myrow['bid']]->assignVar('bid', $myrow['bid']); [/color]
$instance->setBlock($blocks[$myrow['bid']]);
$ret[] = $instance;
unset($instance);
}
}
return $ret;
}
}
The key -bid- should be registered in both $instance and $blocks[].
And this is the main issue.
Some blocks (eg. minical_ex in piCal) have to know their instanceid. (`bid` in 2.0.x)
In 2.0.x, I used $GLOBALS['block_arr'][$GLOBALS['i']]->getVar('bid') .
But in 2.2, it is useless.
Please implement some way for blocks to know instanceid of themselves.
eg) kernel/blockinstance.php line 109
from:
$block = $show_func($options);
to:
$block = $show_func($options+array('instanceid'=>$this->getVar('instanceid')));
The block can know its instanceid by $options['instanceid'].
This is MUST feature to modify my modules as fully compatible with XOOPS 2.2.
I'm glad if you also implement some way for show_func to change block's title dynamically.
Regards!