如何在node节点的评论下面添加想要…
2012-11-29 14:20
417 查看
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 变量)
- Hadoop添加节点datanode
- 如何遍历链表,给链表添加新节点
- sharepoint 2010 如何给文档库或自定义列表添加评论功能
- 如何动态添加树节点(.NET)
- 如果dom节点是动态添加进页面的,在页面节点绑定事件如何解决的问题。
- nodejs handlebars 如何添加helper
- Jquery-easyui的默认图标的使用,以及如何添加自己想要的图标
- Cocos2d如何实现一个指针的添加节点
- Hadoop添加节点datanode(生产环境)
- ASP.NET - 如何:添加或删除 TreeView 节点元素
- 如何在SolrCloud中添加删除节点
- TTreeView如何添加节点附加数据
- sharepoint 2010 如何给文档库或自定义列表添加评论功能
- Aspose.Words:如何添加另一个WORD文档中的Node对象
- leetCode 117.Populating Next Right Pointers in Each Node II (为节点添加右指针) 解题思路和方法
- 在AODV中添加恶意节点:NS2: Adding Malicious Node to AODV修改版
- Hadoop添加节点datanode
- 如何添加个性的博客评论头像?