示例#1
0
 public function index()
 {
     $s = doSafe($_GET['s']);
     $p = !empty($_GET['p']) ? (int) doSafe($_GET['p']) : 1;
     $article = new ArticleModel();
     //合计文章数目
     $total = $article->getTotal($s);
     //输出首页数据
     if ($total == 0) {
         if ($p < 1) {
             $this->display("Error/index.tpl");
             exit;
         }
     } else {
         if ($p < 1 || $p > ceil($total / $this->pageNum)) {
             $this->display("Error/index.tpl");
             exit;
         }
     }
     $articleList = $article->getArticle($p, $this->pageNum, $s);
     //			获取分页条
     $getPage = new Page();
     $this->assign(array('total' => $total, 'page' => $getPage->getPage(APP . '/search/?s=' . $s . '&p=', $total, $this->pageNum, $p), 'articleList' => $articleList));
     $this->display('Search/index.tpl');
 }
示例#2
0
 public function index()
 {
     $count = $this->article->getCount();
     $p = !empty($_GET['p']) ? $_GET['p'] : 1;
     if ($p < 1 || $p > ceil($count / $this->pageNum)) {
         $this->display("Error/index.tpl");
         exit;
     }
     $data = $this->article->getArticle('web_article.createtime', array(($p - 1) * $this->pageNum, $this->pageNum));
     $page = new Page();
     $pageStr = $page->getPage(APP . '/Admin/Article/index/p/', $count, $this->pageNum, $p);
     $this->assign(array('data' => $data, 'page' => $pageStr, 'ps' => ($p - 1) * $this->pageNum + 1));
     $this->display('Article/index.tpl');
 }
示例#3
0
 public function index()
 {
     $id = $_GET['id'];
     $p = !empty($_GET['p']) ? (int) doSafe($_GET['p']) : 1;
     if ($id === '') {
         //400页面
         $this->display("Error/index.tpl");
         exit;
     }
     //根据接受信息查询
     $tag = new TagModel();
     $tagInfo = $tag->getIdByInfo($id);
     if (empty($tagInfo)) {
         $this->display("Error/index.tpl");
         exit;
     }
     //通过tag_id找到article_id
     $article = new ArticleModel();
     $articletag = new ArticletagModel();
     $articleIds = $articletag->getArticleIdByTagId($id);
     //合计文章数目
     $total = count($articleIds);
     //输出首页数据
     if ($total == 0) {
         if ($p < 1) {
             $this->display("Error/index.tpl");
             exit;
         }
     } else {
         if ($p < 1 || $p > ceil($total / $this->pageNum)) {
             $this->display("Error/index.tpl");
             exit;
         }
     }
     if (empty($articleIds)) {
         //该分类下无文章
         $articleList = array();
     } else {
         //根据ID去查找文章
         $articleList = $article->getArticleByIds($articleIds, $p, $this->pageNum);
     }
     $getPage = new Page();
     $this->assign(array('total' => $total, 'id' => $id, 'page' => $getPage->getPage(APP . '/tag/index/id/' . $id . '/p/', $total, $this->pageNum, $p), 'articleList' => $articleList));
     //			获取分页条
     $this->display('Tag/index.tpl');
 }
 /**
  * SETTER. $view
  * @param string $view    La vue à utliser (par défaut l'action).
  */
 public function setView($view)
 {
     if (!is_string($view) || empty($view)) {
         throw new \InvalidArgumentException('La vue doit être une chaine de caractères valide');
     }
     $this->view = $view;
     $this->page->setContentFile('./../Applications/' . $this->app->name() . '/Modules/' . $this->module . '/Views/' . $this->view . '.php');
 }
示例#5
0
 public function index()
 {
     $article = new ArticleModel();
     //合计文章数目
     $total = $article->getTotal();
     //输出首页数据
     $p = !empty($_GET['p']) ? (int) doSafe($_GET['p']) : 1;
     //			$p = $p < 1 ? 1 : $p;
     //			$p = $p > ceil($total/$this->pageNum) ? ceil($total/$this->pageNum) : $p;
     if ($p < 1 || $p > ceil($total / $this->pageNum)) {
         $this->display("Error/index.tpl");
         exit;
     }
     $articleList = $article->getArticle($p, $this->pageNum);
     //			获取分页条
     $getPage = new Page();
     $this->assign(array('page' => $getPage->getPage(APP . '/index/index/p/', $total, $this->pageNum, $p), 'articleList' => $articleList, 'APP' => APP));
     $this->display('Index/index.tpl');
 }
示例#6
0
 public function userComment()
 {
     $commentUser = new CommentuserModel();
     $count = $commentUser->getCount();
     $p = !empty($_GET['p']) ? $_GET['p'] : 1;
     if ($p < 1 || $p > ceil($count / $this->pageNum)) {
         $this->display("Error/index.tpl");
         exit;
     }
     $this->commentUser = $commentUser->getUser(array(($p - 1) * $this->pageNum, $this->pageNum));
     $page = new Page();
     $this->show = $page->getPage(APP . '/Admin/User/usercomment/p/', $count, $this->pageNum, $p);
     $this->ps = ($p - 1) * $this->pageNum + 1;
     $this->display('User/usercomment.tpl');
 }