Community & Support

Fatal error: Call to undefined function node_add(), but it works for one page load after cache is cleared

I'm trying to post a node add form for my cck type in Drupal 6. So as I did in drupal 5 I did this:

<?php
print node_add('contenttype');
?>

But that results in Fatal error: Call to undefined function node_add(). After debugging for xx hours I've found out it will work for ONE page load after I clear the cache using the devel module(devel/cache/clear). Then after the form has been rendered once it suddenly can't find the node_add function..

Comments

You will have to do it

You will have to do it similarly like in the following code snippet

   if( ! function_exists("node_object_prepare")) {
      include_once(drupal_get_path('module', 'node') . '/node.pages.inc');
   }

but I haven't looked up if your mentioned function is located in the same file. That you have to find yourself.

Regards
Werner