【发布时间】:2023-03-28 18:35:01
【问题描述】:
我正在尝试使用下一个代码从外部脚本添加新节点:
define('DRUPAL_ROOT', getcwd());
include_once './includes/bootstrap.inc';
drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL);
$node = new stdClass();
$node->title = "Your node title";
$node->body = "The body text of your node.";
$node->type = 'rasskazi';
$node->created = time();
$node->changed = $node->created;
$node->status = 1; // Published?
$node->promote = 0; // Display on front page?
$node->sticky = 0; // Display top of page?
$node->format = 1; // Filtered HTML?
$node->uid = 1; // Content owner uid (author)?
$node->language = 'en';
node_submit($node);
node_save($node);
但是如何设置自定义字段值(例如'sup_id'整数)?
【问题讨论】: