嘿,有人可以通过 node_load() 加载节点来提供帮助吗
Hey can someone help by loading a node with node_load()
我检查是否存在特定内容
// Check If node already exists
$nodeexist = db_select('field_data_field_id', 'r')
->fields ('r', array('field_id_value'))
->condition ('field_id_value', $row->id, '=')
->execute()
->fetchAssoc();
如果不存在我创建新内容,
但如果它存在我如何加载它,改变一些参数,
将感谢您的帮助
如果字段附加到节点,您可以找到带有 'entity_id' 列的 nid,如下所示:
$nid = db_select('field_data_field_id', 'r')
->fields ('r', array('entity_id'))
->condition ('field_id_value', $row->id, '=')
->condition ('entity_type', 'node', '=')
->execute()
->fetchField();
if(!empty($nid)){
$node = node_load($nid);
}else{
// TODO: create new node
}
我检查是否存在特定内容
// Check If node already exists
$nodeexist = db_select('field_data_field_id', 'r')
->fields ('r', array('field_id_value'))
->condition ('field_id_value', $row->id, '=')
->execute()
->fetchAssoc();
如果不存在我创建新内容, 但如果它存在我如何加载它,改变一些参数, 将感谢您的帮助
如果字段附加到节点,您可以找到带有 'entity_id' 列的 nid,如下所示:
$nid = db_select('field_data_field_id', 'r')
->fields ('r', array('entity_id'))
->condition ('field_id_value', $row->id, '=')
->condition ('entity_type', 'node', '=')
->execute()
->fetchField();
if(!empty($nid)){
$node = node_load($nid);
}else{
// TODO: create new node
}