The Idea: to have form for add child node right on parent node page. Exactly as this forum have when you are logged.
The way I try to go this: add to parent node CCK Computer Field with code:
$pid = 254; // - ID of current node
$type = 'my_content_type';
global $user;
$nnode->uid = $user->uid;
$nnode->name = $user->name;
$nnode->type = $type;
$nnode->created = time();
$nnode->parent_node = $pid;
$nnode->taxonomy[12] = array('tid' => '12', 'vid' => '4', 'name' => 'news', 'description' =>'' , 'weight' => '0');
require_once(drupal_get_path('module', 'node') . '/node.pages.inc');
$form = drupal_get_form($type .'_node_form', $nnode);
$display = $form;
Everything looks cool, you can fill fields, press save and new node of 'my_content_type' will be created, but... no relationship.
Traditional "http://mysite/node/add/my_content_type/parent/254" works fine...
Any suggestions ?
Thank you!
Comments
Comment #1
Crom commentedsubscribing...exactly what I'm trying to work out how to do and after spending a day or so reading stuff I still can't find a decent way to do it apart from using CCK multigroups which I don't want to do as it's in alpha still.
Any ideas?
Cheers.
Crom