Drupal NAT-ng 和计算领域并不容易交好

发布于 2024-09-16 07:00:25 字数 122 浏览 9 评论 0原文

一整天都尝试计算使用 NAT-ng 分配的子节点的字段。我的逻辑好像还没有到这个地步。据我所知,我需要使用 nid 来获取内容,通过获取它分配给 nat id 我能够获取术语 id 以及分配给该术语的所有节点(也可以过滤内容类型)

All day tried to compute fields from child nodes assigned using NAT-ng. My logic doesn't seem to go so far. As far as I know I need to get content by using nid which is asigned to nat id by getting it I am capable to get term id and all nodes assigned to this term (also can filter content types)

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

少女净妖师 2024-09-23 07:00:25

好吧,我自己搞定了。不知道这是否是最好的方法,但至少它有效:)
好的,代码来了

<?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;
?>

,现在 ir 正在使用来自所谓的子节点的字段,高兴吧:)

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 :)

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文