news-show.ctrl.php 927 B

123456789101112131415161718192021222324252627282930313233
  1. <?php
  2. /**
  3. * [WeEngine System] Copyright (c) 2014 WE7.CC
  4. * WeEngine is NOT a free software, it under the license terms, visited http://www.we7.cc/ for more details.
  5. */
  6. defined('IN_IA') or exit('Access Denied');
  7. $dos = array( 'detail', 'list');
  8. $do = in_array($do, $dos) ? $do : 'list';
  9. load()->model('article');
  10. if($do == 'detail') {
  11. $id = intval($_GPC['id']);
  12. $news = article_news_info($id);
  13. if(is_error($news)) {
  14. itoast('新闻不存在或已删除', referer(), 'error');
  15. }
  16. }
  17. if($do == 'list') {
  18. $categroys = article_categorys('news');
  19. $categroys[0] = array('title' => '所有新闻');
  20. $cateid = intval($_GPC['cateid']);
  21. $filter = array('cateid' => $cateid);
  22. $pindex = max(1, intval($_GPC['page']));
  23. $psize = 20;
  24. $newss = article_news_all($filter, $pindex, $psize);
  25. $total = intval($newss['total']);
  26. $data = $newss['news'];
  27. $pager = pagination($total, $pindex, $psize);
  28. }
  29. template('article/news-show');