如何在node节点的评论下面添加想要…
2012-11-29 14:22
357 查看
node的评论节点显示是由下面的函数来控制的。
这个函数在node.module里面
function node_show($node, $cid) {
$output = node_view($node, FALSE, TRUE);
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);
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) {
$output = node_view($node, FALSE, TRUE);
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节点的评论下面了。
这个函数在node.module里面
function node_show($node, $cid) {
$output = node_view($node, FALSE, TRUE);
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);
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) {
$output = node_view($node, FALSE, TRUE);
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节点的评论下面了。
相关文章推荐
- 如何在node节点的评论下面添加想要…
- Drupal6 如何调整文章下方的“添加评论”等链接(node.tpl.php 中 的 $links 变量)
- DOM--如何添加、移除、移动、复制、创建和查找节点等。
- 如何在Drupal7中用代码批量创建节点、评论和分类
- 如何优雅的添加MGR节点?
- 如何给Ghost博客添加多说评论
- K8S对node添加label,并根据label筛选节点
- Hadoop添加节点datanode(生产环境)
- Hadoop添加节点datanode
- sharepoint 2010 如何给文档库或自定义列表添加评论功能
- 如何动态添加树节点(.NET)
- Aspose.Words:如何添加另一个WORD文档中的Node对象
- 在AODV中添加恶意节点:NS2: Adding Malicious Node to AODV修改版
- Android 如何实现展示多个新闻标题,每个标题下面带有不同个数的评论?
- TTreeView如何添加节点附加数据
- C# winform treeview node添加右键菜单并选中节点
- sharepoint 2010 如何给文档库或自定义列表添加评论功能
- hadoop集群的负载均衡配置与添加DataNode节点和TaskTracker节点
- C# winform treeview node添加右键菜单并选中节点
- 如何利用Element元素在末尾添加节点