I have created a Block… and am displaying a node (loading a node in it).
function my_module_block_info() {
$blocks = array();
$blocks['my-block-id'] = array(
'info' => t('Block Name'),
);
return $blocks;
}
function my_module_block_view($delta='') {
$block = array();
switch ($delta) {
case 'my-block-id':
$block['subject'] = t('Block Name');
$block['content'] = my_module_contents();
break;
}
return $block;
}
function my_module_contents() {
return 'iframe width="560" height="315" src="http://localhost/try/node/27" frameborder="0" allowfullscreen /iframe';
}
As am using iframe so it renders all the content on the page but I want to display only the NODE Content in block, I don’t want the header, menu, and footer to appear in the block.
Below is the image, thanks

Update :
If I implement node_view as per below code the node does get rendered as a full node but this only works if your block is on a node if the block is on another path say admin/structure/nodequeue then it does not work. So how can I make this work on such a path ? Pls help
function my_module_contents() {
return drupal_render(node_view(node_load(27), 'full'));
}
FINAL SOLVED SOLUTION *
Below is the code which worked. Thank you laxman for your help
function customvishal_block_info() {
$blocks = array();
$blocks['my-block-id'] = array(
'info' => t('Block Name'),
);
return $blocks;
}
function customvishal_block_view($delta='') {
$block = array();
switch ($delta) {
case 'my-block-id':
$block['subject'] = t('Block Name');
$block['content'] = my_module_contents();
break;
}
return $block;
}
function my_module_contents() {
$customvishalfull= drupal_render(node_view(node_load(155), 'full'));
// print_r($customvishalfull);
// Example of creating and calling "strike" theme function.
$output .= '<h2>Custom "strike" theme function</h2>';
$output .= theme('customvishal_strike', array('string' =>$customvishalfull));
return $output;
}
function customvishal_theme() {
return array(
'customvishal_strike' => array(
'variables' => array('string' => array()),
'template' => 'property',
),
);
}
Since you are using the iframe, it will load the entire page as you have experienced. Consider using
drupal_render(),node_load(), andnode_view()to display only the node information. Youcould change
my_module_contents()to:You could also change ‘full’ to ‘teaser’ to show the teaser of the node.