本文整理匯總了PHP中CommentModel::getCommentCountByArticleId方法的典型用法代碼示例。如果您正苦於以下問題:PHP CommentModel::getCommentCountByArticleId方法的具體用法?PHP CommentModel::getCommentCountByArticleId怎麽用?PHP CommentModel::getCommentCountByArticleId使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類CommentModel
的用法示例。
在下文中一共展示了CommentModel::getCommentCountByArticleId方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: index
public function index()
{
//var_dump($_SESSION['qq']);
$articleId = $_GET['articleId'];
$article = new ArticleModel();
$content = $article->getArticleById($articleId);
$collect = new CollectModel();
$comment = new CommentModel();
$commentNum = $comment->getCommentCountByArticleId($articleId);
$content['commentNum'] = $commentNum;
if ($this->isLogin()) {
if ($collect->getCollects($article, $_SESSION['qq']['userId'])) {
$this->assign('collects', '已收藏');
} else {
$collectNum = $collect->getCollectCountByuserId($article);
$this->assign('collectNum', $collectNum);
$this->assign('collects', '收藏');
}
}
$this->assign('article', $content);
//評論查詢
$comments = $comment->getComment($articleId);
$user = new UserModel();
$arr = array();
foreach ($comments as $key => $val) {
$val[$key]['user'] = $user->getUserById($val['userId']);
}
$this->assign('comments', $comments);
$this->display();
}
示例2: getArticleById
public function getArticleById()
{
$errors = $this->errors;
$articleId = $_GET['articleId'];
//實例化Model
$adminModel = new AdminModel();
//博主
$articleModel = new ArticleModel();
//文章
$articleTypeModel = new ArticleTypeModel();
//文章分類
$articleTagModel = new ArticleTagModel();
//文章標簽
$commentModel = new CommentModel();
//評論
$collectModel = new CollectModel();
//文章收藏
//獲取所有文章分類
$allTypes = $articleTypeModel->getCatrgoryByAdminId($_SESSION['admin']['adminId']);
$allTypes = formatkey($allTypes, 'typeId');
//設置typeId主鍵
//獲取所有文章標簽
$allTags = $articleTagModel->getArticleTag();
$allTags = formatkey($allTags, 'tagId');
//設置typeId主鍵
$articleInfo = $articleModel->getArticleById($articleId);
if ($articleInfo['tagId']) {
$articleInfo['tagId'] = explode(',', trim($value['tagId'], ','));
}
//查詢評論數
$articleInfo['commentCount'] = $commentModel->getCommentCountByArticleId($articleId);
//查詢收藏數
$articleInfo['collectCount'] = $collectModel->getCollectCountByArticleId($articleId);
//獲取最新的評論
$comment = $commentModel->getComment($articleId, '0,2');
//博主信息
$adminInfo = $adminModel->getAdminById($_SESSION['admin']['adminId']);
$this->assign("admin", $adminInfo);
//文章
$this->assign("article", $articleInfo);
//文章
$this->assign("allTags", $allTags);
//所有文章標簽
$this->assign("allTypes", $allTypes);
//某人所有文章分類
$this->assign("comment", $comment);
//某人所有文章分類
}
示例3: articleInfo
public function articleInfo()
{
//實例化Model
$articleModel = new ArticleModel();
//文章
$commentModel = new CommentModel();
//評論
$collectModel = new CollectModel();
//文章收藏
$articleId = Data::get($_GET['articleId'], Data::Int);
if (!is_int($articleId) && $articleId <= 0) {
R('Index', 'index');
}
$articleModel->setIncArticleByHitNum($articleId);
//文章信息
$content = $articleModel->getArticleById($articleId);
//文章評論數
$commentNum = $commentModel->getCommentCountByArticleId($articleId);
$content['commentNum'] = $commentNum;
//文章收藏數
$collectNum = $collectModel->getCollectCountByarticleId($articleId);
$content['collectNum'] = $collectNum;
//是否已經收藏
$if_collect = 0;
if ($_SESSION['qq']) {
if ($collectModel->getCollects($articleId, $_SESSION['qq']['userId'])) {
$if_collect = 1;
}
}
//評論查詢
$comments = $commentModel->getComment($articleId);
//用戶個人信息
$allUserInfo = $this->getAllUserInfo();
//博主個人信息
$blogerInfo = $this->getBlogerInfo($content['adminId']);
//獲取所有文章分類
$allTypes = $this->getAllTypes($content['adminId']);
//獲取所有文章標簽
$allTags = $this->getAllTags();
//文章總數
$count = $this->articleCount($content['adminId']);
//最新三條評論
$latestComments = $this->getLatestComments($content['adminId'], '0,3');
$this->assign('count', $count);
//某博主文章總數
$this->assign("allTags", $allTags);
//所有文章標簽
$this->assign("allTypes", $allTypes);
//某人所有文章分類
$this->assign('blogerInfo', $blogerInfo);
//某博主信息
$this->assign('allUserInfo', $allUserInfo);
//某用戶信息
$this->assign('latestComments', $latestComments);
//最新三條評論
$this->assign('if_collect', $if_collect);
//是否已經收藏
$this->assign('article', $content);
//文章詳情
$this->assign('comments', $comments);
$this->display();
}