人人商城

case.php 1.9KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. <?php
  2. if (!(defined('ES_PATH'))) {
  3. exit('Access Denied');
  4. }
  5. class CaseController extends Controller
  6. {
  7. public function index()
  8. {
  9. global $_W;
  10. global $_GPC;
  11. $uniacid = intval($_GPC['__uniacid']);
  12. $pindex = max(1, intval($_GPC['page']));
  13. $psize = 12;
  14. $condition = ' and a.status = 1 ';
  15. $params = array();
  16. if (!(empty($_GPC['cate']))) {
  17. $cateid = intval($_GPC['cate']);
  18. $condition .= ' and a.cate = :cate';
  19. $params[':cate'] = $cateid;
  20. }
  21. $articles = pdo_fetchall('SELECT a.* ,c.id as cid,c.name FROM ' . tablename('ewei_shop_system_case') . ' AS a' . "\n" . ' LEFT JOIN ' . tablename('ewei_shop_system_casecategory') . ' AS c ON a.cate = c.id and c.status = 1' . "\n" . ' WHERE 1 ' . $condition . ' ORDER BY a.displayorder DESC LIMIT ' . (($pindex - 1) * $psize) . ',' . $psize, $params);
  22. $total = pdo_fetchcolumn('SELECT count(1) FROM ' . tablename('ewei_shop_system_case') . ' WHERE status = 1 ', $params);
  23. $category = pdo_fetchall('select id,name from ' . tablename('ewei_shop_system_casecategory') . ' where status = 1 order by displayorder asc ');
  24. $pager = $this->pagination($total, $pindex, $psize);
  25. $casebanner = pdo_fetch('select casebanner,background from ' . tablename('ewei_shop_system_setting') . ' where uniacid = :uniacid ', array(':uniacid' => $uniacid));
  26. $basicset = $this->basicset();
  27. $title = '案例展示';
  28. include $this->template('case/index');
  29. }
  30. public function detail()
  31. {
  32. global $_W;
  33. global $_GPC;
  34. $id = intval($_GPC['id']);
  35. $article = pdo_fetch('SELECT * FROM ' . tablename('ewei_shop_system_case') . ' AS a' . "\n" . ' LEFT JOIN ' . tablename('ewei_shop_system_casecategory') . ' AS c ON a.cate = c.id' . "\n" . ' WHERE a.id = ' . $id);
  36. $basicset = $this->basicset();
  37. $title = $article['title'];
  38. include $this->template('news/detail');
  39. }
  40. }
  41. ?>