I'm using nodeblock for my translated blocks. In one case I append a common block to nodes of a type within a custom module via hook_nodeapi

It seems that the module_invoke for nodeblock - block - view causes an error that results in: "No data received" (Chrome) "Error 324 (net::ERR_EMPTY_RESPONSE): The server closed the connection without sending any data."

Pretty sure I'm doing the module invoke in a normal manner that matches the normal architecture of the nodeblock_block view operation.
Stumped.

Here is my code in question...

define("BLOCK_DELTA", 12600); // (node block)
function MYMODULE_nodeapi(&$node, $op, $a3 = NULL, $a4 = NULL) {
  if ($op == 'load' && $node->type == 'my_type')  {
    $block =  module_invoke('nodeblock', 'block', 'view', BLOCK_DELTA); // THIS LINES CAUSES THE ERROR
    // override an empty field with block content
    if ($node->field_myfield[0]['value'] == '' || is_null($node->field_myfield[0]['value'])) { 
      $node->field_myfield[0]['value'] = $block['content']; 
      $node->field_myfield[0]['format'] = 4; 
    }
  }
}

Comments

doublejosh’s picture

BTW: This is a WOD (white screen of death) type error.

doublejosh’s picture

Appears this happens when the block delta is incorrect (obviously).

However, we've had problems invoking blocks at the module level within a node_api function.

Yet, module_invoke('nodeblock'... does work when done in eval code via PHP input filter. So perhaps nodeblock isn't yet available at the node_api level?

doublejosh’s picture

Tracked it down to the node_view function failing on line 146 when the module invoke is called from within node_api() $op = 'load'

Forced to go with a template.php preprocess solution for now :(

Johnny vd Laar’s picture

Status: Active » Closed (won't fix)

As this is not normal use of the nodeblock module I'm not going to investigate this for d6.

Johnny vd Laar’s picture

Issue summary: View changes

add comments to code