minor fix to news system

This commit is contained in:
wlx 2012-04-03 15:57:59 +00:00
parent ecdb3d76a2
commit cf085c487b
1 changed files with 8 additions and 5 deletions

View File

@ -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();