Hi,

I'm porting the faq module to Drupal 6.x. I've gone through the Converting 5.x modules to 6.x document, but haven't found anything about a new requirement for a "nodes.pages.inc" file for modules that create their own content types. I'm getting the error below:

Fatal error: require_once() [function.require]: Failed opening required 'sites/all/modules/faq/node.pages.inc' (include_path='.:/usr/share/php:/usr/share/pear') in /var/www/drupal_6.1_20070904/html/includes/menu.inc on line 312

Is this a bug? Or is there a new requirement for a nodes.pages.inc file? If so, can anyone provide more details on what exactly this file should contain?

Cheers,
Stella

Comments

stella’s picture

Priority: Normal » Critical

Changing priority to critical in case this is a bug in drupal core. Feel free to lower the priority if it's not and it's just a documentation issue.

Cheers,
Stella

yched’s picture

Priority: Critical » Normal

Sounds like a wrong copy/paste in you module's hook_menu. One of your menu items probably has a 'file' => 'node.pages.inc' property, which incorrectly tells the menu system that the callback for this item resides in a node.pages.inc file in your module's directory.

stella’s picture

nope, I don't have that in my hook_menu() function, or anywhere in faq.module for that matter. The code is all checked into CVS in case you want to verify that, but I've pasted my hook_menu() function below.

/**
 * Implementation of hook_menu()
 */
function faq_menu() {
  $items = array();

  $items['admin/settings/faq'] = array(
    'title' => 'Frequently Asked Questions Settings',
    'description' => 'Allows the user to configure the layout of questions and answers on a FAQ page.',
    'page callback' => 'faq_settings_page',
    'access callback' => 'user_access',
    'access arguments' => array('administer faq'),
  );
  $items['faq'] = array(
    'title' => variable_get('faq_title', 'Frequently Asked Questions'),
    'page callback' => 'faq_page',
    'access callback' => 'user_access',
    'access arguments' => array('view faq'),
    'weight' => 1
  );
  $items['admin/settings/faq/general'] = array(
    'title' => 'General',
    'description' => 'Allows the user to configure the header and descriptive text for the FAQ page.',
    'page callback' => 'drupal_get_form',
    'page arguments' => array('faq_general_settings_form'),
    'access callback' => 'user_access',
    'access arguments' => array('administer faq'),
    'type' => MENU_DEFAULT_LOCAL_TASK,
    'weight' => -10,
  );
  $items['admin/settings/faq/questions'] = array(
    'title' => 'Questions',
    'description' => 'Allows the user to configure the layout of questions and answers on a FAQ page.',
    'page callback' => 'drupal_get_form',
    'page arguments' => array('faq_questions_settings_form'),
    'access callback' => 'user_access',
    'access arguments' => array('administer faq'),
    'type' => MENU_LOCAL_TASK,
    'weight' => -9,
  );
  $items['admin/settings/faq/categories'] = array(
    'title' => 'Categories',
    'description' => 'Allows the user to configure the layout of questions and answers using categories on a FAQ page.',
    'page callback' => 'drupal_get_form',
    'page arguments' => array('faq_categories_settings_form'),
    'access callback' => 'user_access',
    'access arguments' => array('administer faq'),
    'type' => MENU_LOCAL_TASK,
    'weight' => -8,
  );
  $items['admin/settings/faq/weight'] = array(
    'title' => 'Weight',
    'description' => 'Allows the user to configure the order of questions and answers on a FAQ page.',
    'page callback' => 'drupal_get_form',
    'page arguments' => array('faq_weight_settings_form'),
    'access callback' => 'user_access',
    'access arguments' => array('administer faq'),
    'type' => MENU_LOCAL_TASK,
    'weight' => -8,
  );

  $items['node/add/faq'] = array(
    'title' => 'FAQ',
    'access callback' => 'user_access',
    'access arguments' => array('create faq'),
  );

  $items['faq/%'] = array(
    'title' => variable_get('faq_title', 'Frequently Asked Questions'),
    'page callback' => 'faq_page',
    'page arguments' => array(1),
    'access callback' => 'user_access',
    'access arguments' => array('view faq'),
    'type' => MENU_CALLBACK,
  );

  return $items;
}

Cheers,
Stella

yched’s picture

Then I guess it would help if you specified on which page exactly you get the error.

Also, have you tried to force a menu rebuild ? (menu_rebuild() using devel.module's PHp block, or temporarily insert menu_rebuild() after drupal_bootstrap() in index.php, or simply disable/enable a module on the modules admin page).
The bug could be caused by a previous state of your code during your upgrade work, wich might still reside in the menu data.

Crell’s picture

The new page-split mechanism is documented as part of the menu documentation: http://drupal.org/node/146172

As yched said, we'll need to know what page it is that's misbehaving. From the menu hook below, I am going to guess that it's the node/add/faq page? If so, that sounds like a problem with the inheritance logic. Let us know. ;-)

eaton’s picture

Should modules be implementing their node/foo/add path manually at all? Doesn't the node system handle that path automatically?

Crell’s picture

Ya know, I think eaton's right. snpower, try removing that menu hook completely and refreshing the menu. See if that works.

yched’s picture

True in fact. Item 20 on the Converting 5.x modules to 6.x handbook page sort of says that.
Maybe it should be made clearer that node/add/foo is to be *removed* from modules hook_menu ?

Crell’s picture

I have updated the module update page accordingly.

snpower, does any of this help with your issue? :-)

stella’s picture

Status: Active » Fixed

I was having the problem on "node/add/faq". Removing that code from my faq_hook() and disabling/re-enabling the module fixed the problem.

I just noticed you updated the documentation. Thanks, it does make it much clearer now.

Cheers,
Stella

Anonymous’s picture

Status: Fixed » Closed (fixed)