欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

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

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

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

drupal中node的評(píng)論節(jié)點(diǎn)顯示是由下面的函數(shù)來控制的。
這個(gè)函數(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;
}

下面我以實(shí)例說明如何在node節(jié)點(diǎn)的評(píng)論下面添加一些內(nèi)容。
首先用hook_nodeapi鉤子把需要加載的內(nèi)容,寫到node對(duì)象里。這個(gè)函數(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é)點(diǎn)顯示的下面。
如下所示:

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

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

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

相關(guān)文章

最新評(píng)論