0

一整天都在尝试从使用 NAT-ng 分配的子节点计算字段。我的逻辑似乎并没有走这么远。据我所知,我需要通过使用分配给 nat id 的 nid 来获取内容,我能够获取术语 ID 和分配给该术语的所有节点(也可以过滤内容类型)

4

1 回答 1

0

ok got it all by myself. Don't know if it is the best way, but at least it is working :) ok here comes the code

<?php
$count = 0;
$results = db_query("SELECT {content_type_ski_station}.field_to_be_calculated FROM {nat_ng} LEFT JOIN {term_node} ON {nat_ng}.tid = {term_node}.tid LEFT JOIN {content_type_station} ON {term_node}.nid = {content_type_station}.nid WHERE {nat_ng}.nid=%d", $node->nid);
while ($result = db_fetch_array($results))
{
$return = $result;
$count += $return['field_to_be_calculated'];
}
$node_field[0]['value'] = $count;
?>

Now ir is using field from so called children nodes be happy :)

于 2010-08-31T00:51:21.970 回答