Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to display node/add/sometype form on another page?

The whole problem is following:

Lets say we have Items, Items can have Bids, Items can have Questions and Question can have Answer.

When an Item is displayed, all content associated with this Item should also be displayed. Additionally depending on roles, certain forms to make Bids, ask Questions and replay Answers should be display.

How to achieve this? Should I have separate node type for each type? Or should I treat some subtypes like Questions and Answers as comments? Should I use some well-known modules for this?

I am using Drupal 7 and I tried to write a custom module but I didn't get it working properly.

like image 518
user506259 Avatar asked Mar 17 '11 20:03

user506259


1 Answers

module_load_include('inc', 'node', 'node.pages');  $form = node_add('nodetype'); $output = drupal_render($form); 

If your node form has a file upload widget, you should add the following lines to the menu array:

'file path' => drupal_get_path('module', 'node'), 'file' => 'node.pages.inc', 
like image 114
Marius Ilie Avatar answered Sep 27 '22 22:09

Marius Ilie