实现关键词的分类浏览

This commit is contained in:
wlx 2013-04-11 08:31:05 +00:00
parent fbb3f3f7f7
commit d360fd8eff
1 changed files with 10 additions and 4 deletions

View File

@ -190,13 +190,18 @@ class DataController extends Zend_Controller_Action
function tagAction()
{
$id = (int)$this->_request->getParam('id');
$key = $this->_request->getParam('key');
$key = $this->_request->getParam('key');
$keytype = $this->_request->getParam('keytype');
$page=(int)$this->_request->getParam('page');
if (empty($page)) $page=1;
$limit=10;
$offset=$limit*($page-1);
$state=$this->db->query('select keyword,count(*),keytype from keyword group by keyword,keytype order by keytype,keyword,count desc');
$offset=$limit*($page-1);
$sql='select keyword,count(*),keytype from keyword ';
if (!empty($keytype) && ($keytype=='place' || $keytype=='theme' || $keytype=='discipline'||$keytype=='temporal')) $sql.=" where keytype='".$keytype."'";
$sql.=' group by keyword,keytype order by keytype,keyword,count desc';
$state=$this->db->query($sql);
$this->view->keywords=$state->fetchAll();
if ($id>0 or !empty($key)) {
if (empty($key)) {
$where=$this->db->quoteInto('id = ?',$id);
@ -204,7 +209,8 @@ class DataController extends Zend_Controller_Action
$key=$row->name;
}
$this->view->codename=$key;
$sql=$this->db->quoteInto('select count(m.id) from normalmetadata m,keyword k where m.id=k.id and k.keyword=?',$key);
$sql=$this->db->quoteInto('select count(m.id) from normalmetadata m,keyword k where m.id=k.id and k.keyword=?',$key);
$state=$this->db->query($sql);
$row=$state->fetchAll();
$sum=$row[0]['count'];