有时候自己写的页面需要“添加评论”功能,这就需要调用comment.module里的一些函数。
下面的实例说明了如何在页面里添加评论。
$content .= l(t('添加评论'),'comment/reply/'.$node->nid,$attributes = array(),NULL,'comment-form',FALSE,FALSE);//这
个函数是添加评论的按钮
$cid = arg(3);
if (function_exists('comment_render') && $node->comment) {
$content .= comment_render($node, $cid);//这个函数用于显示添加的评论
}
在需要添加评论的地方输入上面的代码就可以实现了。
