本来是想利用.htaccess文件做url的隐性跳转的,不过后来发现不现实,因为很多程序写的都是依赖于url中的文件路径的,不过也因为这个,学到了.htaccess的不少东西,下面分享一个比较好用的!......
2023-03-19 83
本文实例讲述了drupal实现在node节点的评论下面添加内容的方法。分享给大家供大家参考。具体实现方法如下:
drupal中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节点的评论下面了。
希望本文所述对大家的drupal二次开发有所帮助。
以上方法由办公区教程网编辑摘抄整理自互联网可供大家参考!
标签: Drupal
相关文章
本来是想利用.htaccess文件做url的隐性跳转的,不过后来发现不现实,因为很多程序写的都是依赖于url中的文件路径的,不过也因为这个,学到了.htaccess的不少东西,下面分享一个比较好用的!......
2023-03-19 83
关键字描述:绿色 还原 相册 管理 用户 社区 网站 图片 SNS 一个 &ldquo 据统计,我国平均每天新增网民24万,新增网站近3000家。互联网的飞速发展在带给人们海量信息和方便快捷的同时,......
2023-03-14 482
关键字描述:UCenter Home SNS 建站系统 Comsenz 群组 管理 管理员 UCenter Home是Comsenz公司发布的一款SNS建站系统,目前最新版本是1.5。在 UCHom......
2023-03-14 165