echo $block->delta doesn't work

Comments

m4olivei’s picture

Where do you have that statement?

usabilitydeveloper.com’s picture

in the block body field of block configure like /admin/build/block/configure/block/9

m4olivei’s picture

I could be wrong, but the PHP snippit you put into the block body won't have access to the $block variable that your expecting to have.

usabilitydeveloper.com’s picture

Then is there any way to get the block ID/title I want in this case?

m4olivei’s picture

Create a custom block module by creating a custom module and implementing hook_block

http://api.drupal.org/api/function/hook_block/6

You'll want to implement $op = 'list' and $op = 'view' at least. Check out the block_example module and follow that:

http://api.drupal.org/api/drupal/developer--examples--block_example--blo...

Generally I find that if I am feeling the need to create a block with the PHP filter, its generally better to do the block as an implementation of hook_block. Keep code where code should be.

Matt