1
GIJOE
A typo and a request about blockinstance
  • 2005/8/10 9:31

  • GIJOE

  • Quite a regular

  • Posts: 265

  • Since: 2003/8/13


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!

2
skalpa
Re: A typo and a request about blockinstance
  • 2005/8/10 16:22

  • skalpa

  • Quite a regular

  • Posts: 300

  • Since: 2003/4/16


Thank you.

We'll see this as soon as possible. And I like the title idea too, I'll see what can be done (maybe even visibility would be nice if possible).

skalpa.>
Any intelligent fool can make things bigger, and more complex. It takes a touch of genius, a lot of courage, to move in the opposite direction.
Two things are infinite: the universe and human stupidity; and I'm not sure about the 1st one (A.Einstein)

3
GIJOE
Re: A typo and a request about blockinstance
  • 2005/8/10 20:01

  • GIJOE

  • Quite a regular

  • Posts: 265

  • Since: 2003/8/13


hi skalpa.

Thanks for your reply.
Quote:
We'll see this as soon as possible. And I like the title idea too, I'll see what can be done (maybe even visibility would be nice if possible).


It's a nice idea to controlling visibility by show_func().

But show_func can hide itself only by returning array() even in 2.0.13 or 2.2.1


Block's show_func

- can refer
---- its `instanceid`
---- its original `title` (eg. "events in %s")

- can change
---- its `title` (eg. "events in 26 Aug 2005")
---- its visibility

Login

Who's Online

223 user(s) are online (138 user(s) are browsing Support Forums)


Members: 0


Guests: 223


more...

Donat-O-Meter

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

Latest GitHub Commits