diff --git a/application/default/controllers/NewsController.php b/application/default/controllers/NewsController.php index a96a75f4..32f062b6 100644 --- a/application/default/controllers/NewsController.php +++ b/application/default/controllers/NewsController.php @@ -12,16 +12,17 @@ class NewsController extends Zend_Controller_Action function indexAction() { - $sql="select * from news_catlog order by displayorder asc"; + $sql="select * from news_category order by displayorder asc"; $re = $this->db->query($sql); $types = $re->fetchAll(); $this->view->types=$types; $time = date("Y-m-d H:i:s",time()); - $sql = "SELECT arc.*,t.title as typetitle,t.url FROM news_archives arc - LEFT JOIN news_catlog t ON arc.typeid=t.id - WHERE arc.ts_published<'$time' AND pub>=1 ORDER BY ts_published DESC"; + $sql = "SELECT a.*,t.title as typetitle FROM news_archives a + left join news_catelogs cl on a.id=cl.aid + LEFT JOIN news_category t ON cl.cid=t.id + WHERE a.ts_published<'$time' AND is_pub>=1 ORDER BY ts_published DESC"; $rs = $this->db->query($sql); $rows = $rs->fetchAll(); @@ -51,7 +52,9 @@ class NewsController extends Zend_Controller_Action $this->_forward('error', 'error', null, null); } - $sql = "SELECT id,url,title FROM news_catlog WHERE url='$type' "; + $sql = "SELECT a.id,a.title FROM news_category c + left join news_catelogs cl on c.id=cl.cid + left join news_archives a on cl.aid=a.id WHERE c.id='$type' "; $rs = $this->db->query($sql); $row = $rs->fetch();