Last updated May 22, 2012. Created by Gabriel Radic on May 22, 2012.
Log in to edit this page.

To output the RAW content of a block at a URL request, you may want to create a module with this:

<?php
function nkotblock_menu() {
 
/* Output the content of a block in response to a URL request */
 
$items['nkotblock/%/%'] = array (
       
'page callback' => 'show_nkotblock',
       
'title' => 'Show any block on a separate, non-cached page',
       
'access callback' => TRUE,
       
'page arguments' => array(2),
       
'type' => MENU_CALLBACK,
    );
...
?>

... then

<?php
/**
* Building a generic block output system that would be called from iframes.
* See here http://drupal.org/node/499274
*
* $module = The module that created the block, like "system", "views", "menu", other.
* $delta = The ID of the block. Can be a number or a string, like 0, 1, "secondary-links", other.
* $nocache = By default these are not cached. Set to false if they should be. Still TODO.
*/
function show_nkotblock($module = 'system', $delta = 1, $nocache = TRUE){
 
$block = new stdclass; // empty object
 
if ($nocache) {
   
$GLOBALS['conf']['cache'] = FALSE;
  }
 
// @see hook_block()
  // @see module_invoke()
 
$array = module_invoke($module, 'block', 'view', $delta);
 
// must be converted to an object
  // @see block_list()
 
if (isset($array) && is_array($array)) {
    foreach (
$array as $k => $v) {
     
$block->$k = $v;
    }
  }
 
$block->module = $module;
 
$block->delta = $delta;
 
$block->region = 'nkotblock';
    print
theme('block',$block);
}
?>

...then call http://example.com/nkotblock/block/100/0

Looking for support? Visit the Drupal.org forums, or join #drupal-support in IRC.