最新国产好看的视频,伊人天堂AV在线,国产Aaaaaa视频,蜜臀视频在线观看一区,人妻av色图,密臀久久久精品影片,青青视频免费观看毛片,久草在线观看视,国产三级精品色情在线

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

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

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

drupal中node的評論節(jié)點顯示是由下面的函數(shù)來控制的。
這個函數(shù)在node.module里面,如下所示:

復(fù)制代碼
代碼如下:
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里面,如下:

復(fù)制代碼
代碼如下:
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é)點顯示的下面。
如下所示:

復(fù)制代碼
代碼如下:
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ā)有所幫助。

相關(guān)文章

最新評論

宁乡县| 东莞市| 彝良县| 绥滨县| 新巴尔虎右旗| 禄丰县| 曲沃县| 文登市| 渭南市| 陈巴尔虎旗| 丁青县| 唐海县| 精河县| 屏东县| 霞浦县| 安龙县| 红桥区| 德安县| 黄浦区| 潞西市| 三门县| 石泉县| 江阴市| 色达县| 仲巴县| 年辖:市辖区| 泰顺县| 罗城| 新绛县| 新建县| 凉城县| 台江县| 乳源| 纳雍县| 铅山县| 石柱| 淮阳县| 焉耆| 犍为县| 巴楚县| 天柱县|