亚洲乱码中文字幕综合,中国熟女仑乱hd,亚洲精品乱拍国产一区二区三区,一本大道卡一卡二卡三乱码全集资源,又粗又黄又硬又爽的免费视频

drupal實現(xiàn)在node節(jié)點的評論下面添加內(nèi)容的方法

  發(fā)布時間:2014-11-04 10:30:37   作者:佚名   我要評論
這篇文章主要為大家介紹了drupal實現(xiàn)在node節(jié)點的評論下面添加內(nèi)容的方法,涉及相關函數(shù)的修改與hook函數(shù)的使用,具有一定的借鑒價值,需要的朋友可以參考下

本文實例講述了drupal實現(xiàn)在node節(jié)點的評論下面添加內(nèi)容的方法。分享給大家供大家參考。具體實現(xiàn)方法如下:

drupal中node的評論節(jié)點顯示是由下面的函數(shù)來控制的。
這個函數(shù)在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節(jié)點的評論下面添加一些內(nèi)容。
首先用hook_nodeapi鉤子把需要加載的內(nèi)容,寫到node對象里。這個函數(shù)在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;
}

}

然后把上面添加的內(nèi)容寫到node_show函數(shù)的節(jié)點顯示的下面。
如下所示:

復制代碼
代碼如下:
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);
//評論下面添加的“最近流行的內(nèi)容”-jason20080923
$output .= $node->popularterms_html_content;
return $output;
}

這樣需要添加的內(nèi)容就顯示到了node節(jié)點的評論下面了。

希望本文所述對大家的drupal二次開發(fā)有所幫助。

相關文章

最新評論