国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 網(wǎng)站 > 建站經(jīng)驗 > 正文

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

2024-08-30 19:07:48
字體:
供稿:網(wǎng)友

本文實例講述了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ā)有所幫助。

發(fā)表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發(fā)表
主站蜘蛛池模板: 重庆市| 永平县| 桦南县| 衡水市| 义乌市| 嘉禾县| 临泉县| 镇宁| 都昌县| 高清| 林周县| 延庆县| 新源县| 太和县| 濮阳县| 兴隆县| 邵武市| 泸溪县| 山西省| 阿坝| 康乐县| 隆德县| 达日县| 临海市| 江陵县| 富阳市| 祁门县| 佛教| 武定县| 中牟县| 汶上县| 西乌珠穆沁旗| 木兰县| 安岳县| 顺义区| 新巴尔虎左旗| 剑阁县| 望奎县| 阿鲁科尔沁旗| 岳西县| 台南县|