我刚刚通过以下链接了解了如何以编程方式创建论坛和容器
http://www.unibia.com/unibianet/drupal/how-create-drupal-forums-and-containers-programmatically http://www.unibia.com/unibianet/drupal/how-create-drupal-forums-and-containers-programmatically
但从来没有看到任何帖子(谷歌)以编程方式创建论坛主题,无论我应该使用node_save()还是任何替代方案。
请帮助我,伙计们,
谢谢,
埃德温
以编程方式创建新节点的一种快速、安全且简单的方法是使用节点保存() http://api.drupal.org/api/drupal/modules--node--node.module/function/node_save/6:
<?php
// Construct the new node object.
$node = new stdClass();
// Set the values for the node
$node->title = "My new forum topic";
$node->body = "The body of my forum topic.\n\nAdditional Information";
$node->type = 'forum'; // Your specified content type
$node->created = time();
$node->changed = $node->created;
$node->status = 1; // To have published, else use 0
$node->promote = 1; // If you want promoted to front page, else use 0
$node->sticky = 0;
$node->format = 1; // Filtered HTML
$node->uid = 1; // UID of content owner
$node->language = 'en';
// If known, the taxonomy TID values can be added as an array.
$node->taxonomy = array(2,3,1,);
node_save($node);
?>
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)