当前位置: 首页>>代码示例>>PHP>>正文


PHP ArticleModel::getArticleById方法代码示例

本文整理汇总了PHP中ArticleModel::getArticleById方法的典型用法代码示例。如果您正苦于以下问题:PHP ArticleModel::getArticleById方法的具体用法?PHP ArticleModel::getArticleById怎么用?PHP ArticleModel::getArticleById使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ArticleModel的用法示例。


在下文中一共展示了ArticleModel::getArticleById方法的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();
 }
开发者ID:Jnnock,项目名称:myyyk,代码行数:30,代码来源:ArticleCtrl.class.php

示例2: index

 public function index()
 {
     //header('content-type:text/html;charset=utf-8');
     $userId = $_SESSION['qq']['userId'];
     $collect = new CollectModel();
     //查询收藏
     $user_collect = $collect->getCollectByuserId($userId);
     $article = new ArticleModel();
     $arr = array();
     foreach ($user_collect as $v) {
         //根据收藏的文章id查询文章
         $a = $article->getArticleById($v['articleId']);
         //取出admin的昵称
         $a['adminName'] = $this->getAdmin($a['adminId']);
         $arr[] = $a;
     }
     $comment = new CommentModel();
     $commentAlbum = $comment->getCommentByAlbum($userId);
     $album = new AlbumModel();
     $articles = array();
     $albums = array();
     foreach ($commentAlbum as $v) {
         if ($v['albumId'] != null) {
             $c = $album->getAlbumById($v['albumId']);
             $c['adminName'] = $this->getAdmin($v['adminId']);
             $albums[] = $c;
         }
     }
     $commentArticle = $comment->getCommentByArticle($userId);
     foreach ($commentArticle as $v) {
         if ($v['articleId'] != null) {
             $a = $article->getArticleById($v['articleId']);
             $a['adminName'] = $this->getAdmin($v['adminId']);
             $articles[] = $a;
         }
     }
     var_dump($albums);
     $this->assign('user', $_SESSION['qq']['userName']);
     //评论过的相册
     $this->assign('albums', $albums);
     //评论过的文章
     $this->assign('articles', $articles);
     //收藏
     $this->assign('user_collect', $arr);
     $this->display();
 }
开发者ID:Jnnock,项目名称:myyyk,代码行数:46,代码来源:UserCtrl.class.php

示例3: 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);
     //某人所有文章分类
 }
开发者ID:Jnnock,项目名称:myyyk,代码行数:48,代码来源:AdminCtrl.class.php


注:本文中的ArticleModel::getArticleById方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。