0
点赞
收藏
分享

微信扫一扫

如何在node节点的评论下面添加想要…

九月的栩 2022-09-15 阅读 193

node的评论节点显示是由下面的函数来控制的。
这个函数在node.module里面
function node_show($node, $cid) {
if (function_exists('comment_render') && $node->comment) {
$output .= comment_render($node, $cid);
// Update the history table, stating that this user viewed this node.
return $output;
}
下面我以实例说明如何在node节点的评论下面添加一些内容。首先用​​hook_nodeapi​​​钩子把需要加载的内容,写到node对象里。这个函数在popularterms.module里面,如下
function popularterms_nodeapi(&$node, $op, $teaser = NULL, $page = NULL) {
switch ($op) {
case 'load':

if($node->type == 'story'){
$node->popularterms_html_content = popularterms_html_content1();
}
break;
}

}然后把上面添加的内容写到node_show函数的节点显示的下面。
如下所示:
function node_show($node, $cid) {
if (function_exists('comment_render') && $node->comment) {
$output .= comment_render($node, $cid);
// Update the history table, stating that this user viewed this node.
node_tag_new($node->nid);
//评论下面添加的“最近流行的内容”-jason20080923
$output .= $node->popularterms_html_content;
return $output;
}这样需要添加的内容就显示到了node节点的评论下面了。

举报

相关推荐

0 条评论