news.php 766 B

12345678910111213141516171819202122
  1. <?php
  2. namespace WY\app\controller;
  3. use WY\app\libs\Controller;
  4. if (!defined('WY_ROOT')) {
  5. exit;
  6. }
  7. class news extends Controller
  8. {
  9. public function index()
  10. {
  11. $news = $this->model()->select()->from('arlist')->where(array('fields' => 'cid=? and is_state=?', 'values' => array(3, 1)))->orderby('id desc')->fetchAll();
  12. $this->put('news.php', array('title' => '行业动态', 'news' => $news));
  13. }
  14. public function view()
  15. {
  16. $id = isset($this->action[2]) ? intval($this->action[2]) : 0;
  17. $data = $this->model()->select()->from('arlist')->where(array('fields' => 'is_state=? and id=? ', 'values' => array(1, $id)))->fetchRow();
  18. $this->put('view.php', array('title' => $data['title'], 'data' => $data));
  19. }
  20. }
  21. ?>