1
subirdkimo
Howto get the current block id?
  • 2006/5/22 10:41

  • subirdkimo

  • Just popping in

  • Posts: 3

  • Since: 2005/11/21


Dear All
How can I get the current block id in the block_show function?
thankx!

2
Quest
Re: Howto get the current block id?
  • 2006/5/22 11:01

  • Quest

  • Friend of XOOPS

  • Posts: 1034

  • Since: 2005/11/19


If I understand you correctly, you should be able to find what you are looking for in:
administration/system/groups
Go into the webmaster group (for example) scroll down to Block Access area and you should see the blocks listed and the ID# for the block.

Quest

3
subirdkimo
Re: Howto get the current block id?
  • 2006/5/23 2:55

  • subirdkimo

  • Just popping in

  • Posts: 3

  • Since: 2005/11/21


Thanks your kindly reply!
and sorry for my unclearly describe, the real question I fact to is when I design a block in my module, I have specified
$modversion['blocks'][1]['file'] = "CH_blocks.php";
$modversion['blocks'][1]['show_func'] = "block_show"; in the xoops_version.php file.
And now I try to get the block id in the block_show function by php code in the CH_blocks.php file, but I don't know how to get the current block(or instance) id which I just design or to get the property of the block(for example: the title of the block...).

4
skalpa
Re: Howto get the current block id?
  • 2006/5/23 3:51

  • skalpa

  • Quite a regular

  • Posts: 300

  • Since: 2003/4/16


As stupid as it sounds, you can't... (but you're free to post it as a feature request, it would be a no-risk 5mins change ).
Anyway, if you really need that right now, you can find the following lines in class/xoopsblock.php:
// execute the function
                    
$block $show_func($options);
                    if ( !
$block ) {
                        return 
false;
                    }

and replace the function call by $show_func( $options, $this );

once this is done, you should get the current XoopsBlock object instance passed as a 2nd parameter (and thus access the block id using $yourparamname->getVar( 'bid' ) from the block function).

PS: It's for 2.0.x... for 2.2.x the file to change is kernel/block.php
PS2: The feature requests trackers can be accessed by using the "Report core bug" on the left, then "Feature requests"

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)

5
subirdkimo
Re: Howto get the current block id?
  • 2006/5/23 7:19

  • subirdkimo

  • Just popping in

  • Posts: 3

  • Since: 2005/11/21


Thanks a lots,anyway!
But due to I use the 2.2.3 final version, and I explore the kernel/block.php file, I cannot find the keywords "$block = $show_func($options);" that you mention about. And the detail in kernel/block.php is not easy for me to understand, does anyone can help me more? thanks again!

Login

Who's Online

157 user(s) are online (103 user(s) are browsing Support Forums)


Members: 0


Guests: 157


more...

Donat-O-Meter

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

Latest GitHub Commits