人人商城

news-show.ctrl.php 1.0KB

123456789101112131415161718192021222324252627282930313233343536
  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. $_W['page']['title'] = $news['title'] . '-新闻列表';
  17. }
  18. if($do == 'list') {
  19. $categroys = article_categorys('news');
  20. $categroys[0] = array('title' => '所有新闻');
  21. $cateid = intval($_GPC['cateid']);
  22. $_W['page']['title'] = $categroys[$cateid]['title'] . '-新闻列表';
  23. $filter = array('cateid' => $cateid);
  24. $pindex = max(1, intval($_GPC['page']));
  25. $psize = 20;
  26. $newss = article_news_all($filter, $pindex, $psize);
  27. $total = intval($newss['total']);
  28. $data = $newss['news'];
  29. $pager = pagination($total, $pindex, $psize);
  30. }
  31. template('article/news-show');