Perhaps the question is simple, but I can not understand how to return the body of a node without a menu. I did a module that loads the content of node into the custom area.
function loadnode_in_region_menu_alter(&$items) {
$items['load_node/%'] = array(
'page callback' => 'loadnode_in_region_node_page_view',
'page arguments' => array(1),
'access callback' => 'user_access',
'access arguments' => array('access content'),
'type' => MENU_CALLBACK,
);
return $items;
}
function loadnode_in_region_node_page_view($nid) {
$node = node_load($nid, NULL, false);
$vnode = node_view($node);
return drupal_render($vnode);
}
JS looks like
jQuery.ajax({
type: 'GET',
url: Drupal.settings.basePath + 'load_node/' + id,
dataType: 'html',
success: function(data){
jQuery('#ajax-result').html(data);
},
});
Result looks like this, with a duplicate menu
If I change line from
return drupal_render($vnode);
to
echo drupal_render($vnode); OR print drupal_render($vnode);
The result looks like I would like it, but some fields are not displayed correctly, such as voting and image. Looks as if they are not themed.
How to return themed node body without a menu?