1

I want to render node/7 on /mymodule/info. I don't want to use path to cover it. What callback function shall I use?

function mymodule_menu() {
  $items = array();

  $items['mymodule/info'] = array(
    'title' => t('My module'),
    'description' => t('My module description'),
    'page callback' => ?????????,
    'type' => MENU_CALLBACK,
   );

  return $items;
}
1

You have to call the same callback issued from node/%node menu i.e. node_page_view :

function mymodule_menu() {
  $items = array();

  $items['mymodule/info'] = array(
    'title' => t('My module'),
    'description' => t('My module description'),
    'page callback' => 'node_7',
    'type' => MENU_CALLBACK,
  );
  return $items;
}


function node_7(){

include_once(drupal_get_path('module','node') . '/node.pages.inc');

return node_page_view(node_load('7'));

}
-1

Try

function mymodule_menu() {
  $items = array();
  $items['mymodule/info'] = array(
    'title' => t('My module'),
    'description' => t('My module description'),
    'page callback' => 'rendernodeseven',
    'type' => MENU_CALLBACK,
  );
  return $items;
}


function rendernodeseven() {
    print_r(node_load(7));
}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.