0
我正在嘗試更新hook_cron函數上的Node。我使用Drupal6這裏是我的代碼節點更新掛鉤Cron
function offers_cron() {
$query= db_query("SELECT * FROM {node} WHERE type = 'product'");
while($allnodes = db_fetch_object($query)){
$node_id=$allnodes->nid;
$node=node_load($node_id);
$node = new stdClass();
$node->nid = $node_id;
$node->type = 'product';
$node->language = 'en';
$node->uid=1;
$node->status = 1;
$node->created = time();
$node->changed = $node->created;
$node->comment=0;
$node->promote = 0;
$node->sticky = 0;
$node->format = 2;
$node->title='test';
$node->field_price[0]['value']='120';
if ($node = node_submit($node)) {
node_save($node);
drupal_set_message(t("Node ".$node->title." added correctly"));
} else {
drupal_set_message(t("Node ".$node->title." added incorrectly"), "error");
}
}
}
現在它顯示它已更新,這裏所有的節點是屏幕截圖,該
現在,當我點擊它亙古不顯示任何節點的任何更新用 看到這裏
不限人體有想法關於本
通過它發生問題。我甚至清除緩存
關閉跨站點張貼:http://drupal.stackexchange.com/questions/22621/node-update-problem -on-鉤的cron – casperOne 2012-02-15 22:15:07