Embedding CCK content type create form in your page
Task · How to customize content by embedding CCK · Developers and coders · Drupal 6.x · No known problems
Last modified: August 26, 2009 - 23:42
To embed CCK node create form into page/node in Drupal 6.x or other template file use the following code. Replace "store_review" with the machine-readable name of your content type (for example, Story nodes are "story" and "Store Reviews" are "store_review").
$node = new stdClass();
$node->type = 'store_review';
module_load_include('inc', 'node', 'node.pages');
$output = drupal_get_form('store_review_node_form', $node);I spent several hours looking for solution. Here is the link to original source of the solution: http://drupal.org/node/261495
Alternative
if(!function_exists("node_object_prepare")) {
include_once(drupal_get_path('module', 'node') . '/node.pages.inc');
}
print node_add('store_review');
It doesn't work
I have a custom content-type name 'pembaca' to implement those technic. So, I copy node.tpl.php and then rename to node-pembaca.tpl.php.
Embed above code and make little change to:
$node = new stdClass();
$node->type = 'pembaca';
module_load_include('inc', 'node', 'node.pages');
$output = drupal_get_form('pembaca_node_form', $node);
Then it doesn't work.
Can you help me? What's wrong?
It doesn't work
I have a custom content-type name 'pembaca' to implement those technic. So, I copy node.tpl.php and then rename to node-pembaca.tpl.php.
Embed above code and make little change to:
$node = new stdClass();$node->type = 'pembaca';
module_load_include('inc', 'node', 'node.pages');
$output = drupal_get_form('pembaca_node_form', $node);
Then it doesn't work.
Can you help me? What's wrong?
You have to print the output
The $output variable contains the rendering, but for it to actually appear on the page, you have to "print" it. Did you add a line somewhere similar to:
print $output;Victor Kane
http://awebfactory.com.ar