修改文档类,修改后台和前台调用方法
This commit is contained in:
parent
dce305accd
commit
4fef508924
|
@ -57,6 +57,19 @@ class Admin_NewsController extends Zend_Controller_Action
|
|||
$rs = $this->db->query($sql);
|
||||
$rows = $rs->fetchAll();
|
||||
|
||||
foreach($rows as $k=>$v)
|
||||
{
|
||||
if(empty($v['typeid']))
|
||||
{
|
||||
$ev = $News->getArchiveUrlByCid($v['id']);
|
||||
}else{
|
||||
$ev = $News->getArchiveUrlByCid($v['id'],$v['typeid']);
|
||||
}
|
||||
$rows[$k]['type_title'] = $ev['type_title'];
|
||||
$rows[$k]['type_url'] = $ev['type_url'];
|
||||
$rows[$k]['url'] = $ev['archive_url'];
|
||||
}
|
||||
|
||||
$paginator = Zend_Paginator::factory($rows);
|
||||
$paginator->setCurrentPageNumber($this->_getParam('page'));
|
||||
$paginator->setItemCountPerPage($this->view->config->page->max);
|
||||
|
|
|
@ -57,7 +57,8 @@ $('#divFooter').css('position','absolute');
|
|||
<table id="report" class="stylized full" style="width:650px;">
|
||||
<thead>
|
||||
<tr>
|
||||
<th width="70%">新闻标题</th>
|
||||
<th width="50%">新闻标题</th>
|
||||
<th width="15%">栏目</th>
|
||||
<th width="15%">状态</th>
|
||||
<th width="20%">新闻管理</th>
|
||||
</tr>
|
||||
|
@ -73,6 +74,9 @@ $('#divFooter').css('position','absolute');
|
|||
<tr>
|
||||
<td>
|
||||
<a id="titlebtn'.$v['id'].'" class="title"><b>'.$v['title'].'</b></a>
|
||||
</td>
|
||||
<td>
|
||||
<a href="'.$v['type_url'].'"><b>'.$v['type_title'].'</b></a>
|
||||
</td>
|
||||
<td>';
|
||||
if($v['ts_published']<time() and $v['is_pub']>0)
|
||||
|
@ -93,6 +97,7 @@ $('#divFooter').css('position','absolute');
|
|||
}
|
||||
$list .= '</td>
|
||||
<td>
|
||||
<a href="'.$v['url'].'">浏览</a>
|
||||
<a href="/admin/news/newsedit/id/'.$v['id'].'"><b>编辑</b></a>
|
||||
<a href="/admin/news/delete/id/'.$v['id'].'" onclick="return confirm(\'是否确定删除该文章\')">删除</a></td>
|
||||
</tr>
|
||||
|
|
|
@ -0,0 +1,204 @@
|
|||
<?php
|
||||
class ArchivesController extends Zend_Controller_Action
|
||||
{
|
||||
|
||||
private $limit=10;
|
||||
|
||||
function preDispatch()
|
||||
{
|
||||
$this->view->config = Zend_Registry::get('config');
|
||||
$this->db=Zend_Registry::get('db');
|
||||
}
|
||||
|
||||
function indexAction()
|
||||
{
|
||||
$News = new Archive($this->db);
|
||||
$category = new ArchiveCategory($this->db);
|
||||
|
||||
$types = $category->GetCategory();
|
||||
|
||||
foreach($types as $k=>$v)
|
||||
{
|
||||
$parts = array(
|
||||
'ptype'=>$v['ptype'],
|
||||
'type_code'=>$v['code'],
|
||||
);
|
||||
$types[$k]['url'] = $News->makeCategoryUrl($parts);
|
||||
}
|
||||
|
||||
$this->view->types = $types;
|
||||
$this->view->deepField = $category->DeepTitle;
|
||||
|
||||
$time = date("Y-m-d H:i:s",time());
|
||||
|
||||
$sql = "SELECT id,title,code,ptype FROM ".$News->tbl_categorys." where ptype='news'";
|
||||
$sth = $this->db->query($sql);
|
||||
$rows = $sth->fetchAll();
|
||||
|
||||
$newslist = array();
|
||||
|
||||
foreach($rows as $v)
|
||||
{
|
||||
$sql = "SELECT n.*,c.title as typetitle,c.code FROM ".$News->tbl_archives." n
|
||||
left join ".$News->tbl_catalog." ct on ct.aid=n.id
|
||||
left join ".$News->tbl_categorys." c on c.id = ct.cid
|
||||
WHERE n.ts_published<'$time' AND ct.cid={$v['id']} AND n.is_pub=true
|
||||
ORDER BY ts_published DESC
|
||||
LIMIT 10";
|
||||
|
||||
$rs = $this->db->query($sql);
|
||||
$archives = $rs->fetchAll();
|
||||
|
||||
foreach($archives as $k=>$va)
|
||||
{
|
||||
$ev = $News->getArchiveUrlByCid($va['id'],$v['id']);
|
||||
$archives[$k]['url'] = $ev['archive_url'];
|
||||
}
|
||||
|
||||
$parts = array(
|
||||
'ptype'=>$v['ptype'],
|
||||
'type_code'=>$v['code'],
|
||||
);
|
||||
$url = $News->makeCategoryUrl($parts);
|
||||
|
||||
$newslist[$v['id']] = array("title"=>$v['title'],"url"=>$url,"id"=>$v['id'],"list"=>$archives);
|
||||
}
|
||||
$this->view->lists = $newslist;
|
||||
|
||||
|
||||
}
|
||||
|
||||
function listAction()
|
||||
{
|
||||
$ptype = strtolower($this->_request->getParam('ptype'));
|
||||
$type = strtolower($this->_request->getParam('type'));
|
||||
$page = $this->_request->getParam('page');
|
||||
|
||||
if(preg_match("/(\d+)\.html/",$page,$matches))
|
||||
{
|
||||
$this->_forward('archive', 'news', null, array('archive' => $matches['1'] , 'type'=> $type));
|
||||
return true;
|
||||
}
|
||||
|
||||
if(preg_match("/[^a-z0-9]/",$ptype) || preg_match("/[^a-z0-9]/",$type) || preg_match("/[^0-9]/",$page))
|
||||
{
|
||||
$this->_forward('error', 'error', null, null);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
$News = new Archive($this->db);
|
||||
|
||||
$sql = "SELECT id,code,title FROM ".$News->tbl_categorys." WHERE code='$type' AND is_pub=true ";
|
||||
$rs = $this->db->query($sql);
|
||||
$row = $rs->fetch();
|
||||
|
||||
if(empty($row['id']))
|
||||
{
|
||||
$this->_forward('error', 'error', null, null);
|
||||
}
|
||||
|
||||
else{
|
||||
|
||||
$this->view->url = $row['code'];
|
||||
$this->view->title = $row['title'];
|
||||
|
||||
$category = new ArchiveCategory($this->db);
|
||||
|
||||
$types = $category->GetCategory();
|
||||
foreach($types as $k=>$v)
|
||||
{
|
||||
$parts = array(
|
||||
'ptype'=>$v['ptype'],
|
||||
'type_code'=>$v['code'],
|
||||
);
|
||||
$types[$k]['url'] = $News->makeCategoryUrl($parts);
|
||||
}
|
||||
|
||||
$this->view->types = $types;
|
||||
$this->view->deepField = $category->DeepTitle;
|
||||
|
||||
$time = date("Y-m-d H:i:s",time());
|
||||
|
||||
$sql = "SELECT n.*,c.id as typeid,c.code FROM ".$News->tbl_archives." n
|
||||
left join ".$News->tbl_catalog." ct on ct.aid=n.id
|
||||
left join ".$News->tbl_categorys." c ON ct.cid=c.id
|
||||
WHERE c.id='{$row['id']}' AND n.ts_published<'".$time."' AND n.is_pub=true
|
||||
ORDER BY n.ts_published DESC";
|
||||
|
||||
$rs = $this->db->query($sql);
|
||||
$rows = $rs->fetchAll();
|
||||
|
||||
foreach($rows as $k=>$va)
|
||||
{
|
||||
$ev = $News->getArchiveUrlByCid($va['id'],$va['typeid']);
|
||||
$rows[$k]['url'] = $ev['archive_url'];
|
||||
}
|
||||
|
||||
$paginator = Zend_Paginator::factory($rows);
|
||||
$paginator->setCurrentPageNumber($page);
|
||||
$paginator->setItemCountPerPage($this->view->config->page->max);
|
||||
$paginator->setView($this->view);
|
||||
Zend_View_Helper_PaginationControl::setDefaultViewPartial('pagination_param.phtml');
|
||||
$this->view->paginator=$paginator;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function archiveAction()
|
||||
{
|
||||
$type = $this->_request->getParam('type');
|
||||
$archive = $this->_request->getParam('archive');
|
||||
|
||||
$this->view->type = $type;
|
||||
|
||||
if(preg_match("/[^a-z0-9]/",$type) || preg_match("/[^0-9]/",$archive))
|
||||
{
|
||||
$this->_forward('error', 'error', null, null);
|
||||
}
|
||||
|
||||
$News = new Archive($this->db);
|
||||
$category = new ArchiveCategory($this->db);
|
||||
|
||||
$types = $category->GetCategory();
|
||||
foreach($types as $k=>$v)
|
||||
{
|
||||
$parts = array(
|
||||
'ptype'=>$v['ptype'],
|
||||
'type_code'=>$v['code'],
|
||||
);
|
||||
$types[$k]['url'] = $News->makeCategoryUrl($parts);
|
||||
}
|
||||
|
||||
$this->view->types = $types;
|
||||
|
||||
$this->view->deepField = $category->DeepTitle;
|
||||
|
||||
$time = date("Y-m-d",time());
|
||||
|
||||
$sql = "SELECT n.*,c.title as typename,c.code,u.realname as author FROM ".$News->tbl_archives." n
|
||||
left join ".$News->tbl_catalog." ct on ct.aid=n.id
|
||||
left join ".$News->tbl_categorys." c ON ct.cid=c.id
|
||||
LEFT JOIN users u ON n.userid=u.id
|
||||
WHERE c.code='".$type."' AND n.ts_published<'".$time."' AND n.is_pub=true AND n.id=".$archive."
|
||||
ORDER BY n.ts_published DESC";
|
||||
|
||||
$rs = $this->db->query($sql);
|
||||
$row = $rs->fetch();
|
||||
|
||||
if(empty($row['id']))
|
||||
{
|
||||
$this->_forward('error', 'error', null, null);
|
||||
}
|
||||
|
||||
$this->view->infos = $row;
|
||||
|
||||
}
|
||||
|
||||
function searchAction()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,57 @@
|
|||
<?php
|
||||
$config = Zend_Registry::get('config');
|
||||
$this->headTitle($config->title->site);
|
||||
$this->headTitle($this->infos['title']);
|
||||
$this->headTitle()->setSeparator(' - ');
|
||||
$this->headLink()->appendStylesheet('/css/news.css');
|
||||
$this->headScript()->appendFile('/js/jquery-1.7.min.js');
|
||||
$this->breadcrumb('<a href="/">首页</a>');
|
||||
$this->breadcrumb('<a href="/news">新闻中心</a>');
|
||||
$this->breadcrumb('<a href="/news/'.$this->type.'">'.$this->infos['typename'].'</a>');
|
||||
$this->breadcrumb($this->infos['title']);
|
||||
$this->breadcrumb()->setSeparator(' > ');
|
||||
if(!empty($this->infos['keyword'])) $keyword = $this->infos['keyword']; else $keyword = $this->infos['title'];
|
||||
$this->headMeta()->appendName('keywords', $keyword);
|
||||
$this->headMeta()->appendName('description', mb_substr($this->infos['description'],0,180,'utf-8'));
|
||||
?>
|
||||
<div class="full center clear" id="body">
|
||||
<div class="w300 Lfloat clear">
|
||||
<div class="tbox">
|
||||
<div class="title">栏目导航</div>
|
||||
<div class="content navmenu">
|
||||
<ul>
|
||||
<?php
|
||||
if(count($this->types))
|
||||
{
|
||||
foreach($this->types as $k=>$v)
|
||||
{
|
||||
$haed = "";
|
||||
if(!empty($v[$this->deepField])) {$haed = str_repeat(' ',$v[$this->deepField]);}
|
||||
echo '<li><a href="'.$v['url'].'">'.$haed.$v['title'].'</a></li>';
|
||||
$haed = "";
|
||||
}
|
||||
}
|
||||
?>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="Rfloat clear archive_body" id="archive_body">
|
||||
|
||||
<div class="title"><?php echo $this->infos['title'];?></div>
|
||||
<div class="info">时间 : <?php echo date("Y-m-d H:i",strtotime($this->infos['ts_published']));?> 作者 : <?php echo $this->infos['author'];?> 来源 : <?php echo $this->infos['source'];?></div>
|
||||
<div class="archive_content">
|
||||
<table width="100%">
|
||||
<tr>
|
||||
<td>
|
||||
<?php echo $this->infos['body'];?>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<script>
|
||||
$('#archive_body').width($('#body').width()-320);
|
||||
$('#archive_body .archive_content img').css("max-width",$('#archive_body').width());
|
||||
</script>
|
|
@ -0,0 +1,55 @@
|
|||
<?php
|
||||
$this->headTitle($this->config->title->site);
|
||||
$this->headTitle('新闻中心');
|
||||
$this->headTitle()->setSeparator(' - ');
|
||||
$this->headLink()->appendStylesheet('/css/news.css');
|
||||
$this->headScript()->appendFile('/js/jquery-1.7.min.js');
|
||||
$this->breadcrumb('<a href="/">首页</a>');
|
||||
$this->breadcrumb('新闻中心');
|
||||
$this->breadcrumb()->setSeparator(' > ');
|
||||
?>
|
||||
<div class="full center clear" id="body">
|
||||
<div class="w300 Lfloat clear">
|
||||
<div class="tbox">
|
||||
<div class="title">新闻分类</div>
|
||||
<div class="content navmenu">
|
||||
<ul>
|
||||
<?php
|
||||
if(count($this->types))
|
||||
{
|
||||
foreach($this->types as $k=>$v)
|
||||
{
|
||||
$haed = "";
|
||||
if(!empty($v[$this->deepField])) {$haed = str_repeat(' ',$v[$this->deepField]);}
|
||||
echo '<li><a href="'.$v['url'].'">'.$haed.$v['title'].'</a></li>';
|
||||
$haed = "";
|
||||
}
|
||||
}
|
||||
?>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="Rfloat clear" id="archives_list">
|
||||
<?php
|
||||
foreach($this->lists as $v)
|
||||
{?>
|
||||
<?php if(count($v['list'])>0) {?>
|
||||
<div class="list-archives">
|
||||
<div class="list-title"><a href="<?= $v['url'] ?>"><?= $v['title'] ?></a></div>
|
||||
<div class="list-content">
|
||||
<ul>
|
||||
<?php foreach($v['list'] as $arc)
|
||||
{?>
|
||||
<li><a href="<?= $arc['url']?>"><?= $arc['title'] ?></a></li>
|
||||
<?php }?>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
<?php } }
|
||||
?>
|
||||
</div>
|
||||
</div>
|
||||
<script>
|
||||
$('#archives_list').width($('#body').width()-320);
|
||||
</script>
|
|
@ -0,0 +1,75 @@
|
|||
<?php
|
||||
$this->headTitle($this->config->title->site);
|
||||
$this->headTitle('新闻中心');
|
||||
$this->headTitle()->setSeparator(' - ');
|
||||
$this->headLink()->appendStylesheet('/css/news.css');
|
||||
$this->headScript()->appendFile('/js/jquery-1.7.min.js');
|
||||
$this->breadcrumb('<a href="/">首页</a>');
|
||||
$this->breadcrumb('<a href="/news">新闻中心</a>');
|
||||
$this->breadcrumb($this->title);
|
||||
$this->breadcrumb()->setSeparator(' > ');
|
||||
?>
|
||||
<div class="full center clear" id="body">
|
||||
<div class="w300 Lfloat clear">
|
||||
<div class="tbox">
|
||||
<div class="title">新闻分类</div>
|
||||
<div class="content navmenu">
|
||||
<ul>
|
||||
<?php
|
||||
if(count($this->types))
|
||||
{
|
||||
foreach($this->types as $k=>$v)
|
||||
{
|
||||
$haed = "";
|
||||
if(!empty($v[$this->deepField])) {$haed = str_repeat(' ',$v[$this->deepField]);}
|
||||
echo '<li><a href="'.$v['url'].'">'.$haed.$v['title'].'</a></li>';
|
||||
$haed = "";
|
||||
}
|
||||
}
|
||||
?>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="Rfloat clear" id="archives_list">
|
||||
<div class="archives_list">
|
||||
<ul>
|
||||
<?php
|
||||
if(count($this->paginator))
|
||||
{
|
||||
foreach ($this->paginator as $v)
|
||||
{
|
||||
$description = "";
|
||||
if(empty($v['description']))
|
||||
{
|
||||
$description = "No description";
|
||||
}else if (mb_strlen($v['description'])>160)
|
||||
{
|
||||
$description = mb_substr($v['description'],0,160,'utf-8').'...<a href="'.$v['url'].'" class="more">(more)</a>';
|
||||
}else{
|
||||
$description = $v['description'];
|
||||
}
|
||||
echo '<li>';
|
||||
if(!empty($v['image']))
|
||||
{
|
||||
echo '<img src="'.$v['image'].'" style="max-height:200px;float:left;" />';
|
||||
}
|
||||
echo '<a href="'.$v['url'].'" class="title">'.$v['title'].'</a><br />
|
||||
<small>TIME : '.date("Y-m-d H:i",strtotime( $v['ts_published'] )).'</small>
|
||||
<p>'.$description.'</p>
|
||||
</li>';
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
echo '暂无数据';
|
||||
}
|
||||
?>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="pagenavi"><?= $this->paginator; ?></div>
|
||||
</div>
|
||||
</div>
|
||||
<script>
|
||||
$('#archives_list').width($('#body').width()-320);
|
||||
</script>
|
|
@ -0,0 +1,11 @@
|
|||
<?php
|
||||
$config = Zend_Registry::get('config');
|
||||
$this->headTitle($config->title->site);
|
||||
$this->headTitle($config->title->review);
|
||||
$this->headTitle()->setSeparator(' - ');
|
||||
$this->headLink()->appendStylesheet('/css/news.css');
|
||||
$this->headScript()->appendFile('/js/jquery-1.7.min.js');
|
||||
$this->breadcrumb('<a href="/">Home</a>');
|
||||
$this->breadcrumb('News');
|
||||
$this->breadcrumb()->setSeparator(' > ');
|
||||
?>
|
|
@ -265,32 +265,6 @@ class Archive
|
|||
return true;
|
||||
}//DeleteTags
|
||||
|
||||
function getArchive($code='')
|
||||
{
|
||||
$sql = "select a.* from ".$this->tbl_archives." a
|
||||
left join ".$this->tbl_catalog." ac on a.id=ac.aid
|
||||
left join ".$this->tbl_categorys." c on ac.cid=c.id ";
|
||||
if (!empty($code)) $sql.=" where c.code='".$code."'";
|
||||
$rs=$this->db->query($sql);
|
||||
$rows=$rs->fetchAll();
|
||||
return $rows;
|
||||
}
|
||||
|
||||
function getOneArchive($title,$ptype='news')
|
||||
{
|
||||
$sql="update ".$this->tbl_archives." set click=click+1";
|
||||
$this->db->query($sql);
|
||||
$sql = "select a.* from ".$this->tbl_archives." a
|
||||
left join ".$this->tbl_catalog." ac on a.id=ac.aid
|
||||
left join ".$this->tbl_categorys." c on ac.cid=c.id ";
|
||||
$sql.=" where a.title=? and c.ptype=?";
|
||||
$sth=$this->db->prepare($sql);
|
||||
$sth->execute(array($title,$ptype));
|
||||
$rows=$sth->fetch();
|
||||
return $rows;
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
* addArchive() 添加档案
|
||||
*
|
||||
|
@ -326,10 +300,10 @@ class Archive
|
|||
{
|
||||
$temp = $sth->fetch(PDO::FETCH_ASSOC);
|
||||
$newAid = $temp['id'];
|
||||
$News->AddToCatalog($newAid,$typeid);
|
||||
$this->AddToCatalog($newAid,$typeid);
|
||||
if(!empty($keyword))
|
||||
{
|
||||
$News->MakeTags($newAid,$keyword);
|
||||
$this->MakeTags($newAid,$keyword);
|
||||
}
|
||||
return $newAid;
|
||||
}else{
|
||||
|
@ -415,12 +389,115 @@ class Archive
|
|||
return $data;
|
||||
}//scanField
|
||||
|
||||
|
||||
|
||||
//过滤UTF-8字符的html代码
|
||||
function replaceHtml($html)
|
||||
{
|
||||
$newString = htmlentities($html, ENT_QUOTES, "UTF-8");
|
||||
return $newString;
|
||||
}
|
||||
|
||||
/************* 读取 ****************/
|
||||
|
||||
|
||||
/*
|
||||
* makeArchiveUrl()
|
||||
* 创建一个文档的链接
|
||||
* 连接地址需要和路由规则对应
|
||||
*
|
||||
* @param array $parts
|
||||
*
|
||||
* @return string;
|
||||
*/
|
||||
public function makeArchiveUrl($parts)
|
||||
{
|
||||
$http_host = "http://".$_SERVER ['HTTP_HOST'];
|
||||
$controller = "archives";
|
||||
$url = $http_host."/".$controller."/".$parts['ptype']."/".$parts['type_code']."/".$parts['archive_id'].".html";
|
||||
return $url;
|
||||
}
|
||||
|
||||
public function makeCategoryUrl($parts)
|
||||
{
|
||||
$http_host = "http://".$_SERVER ['HTTP_HOST'];
|
||||
$controller = "archives";
|
||||
$url = $http_host."/".$controller."/".$parts['ptype']."/".$parts['type_code']."";
|
||||
return $url;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* getArchiveUrl()
|
||||
* 通过文档ID和栏目ID获得某个文档的url
|
||||
* 仅适用于单个栏目的文档且已经得知其栏目ID
|
||||
* 如果是多个栏目的文档,则获取第一个栏目的文档连接
|
||||
*
|
||||
* @param int $aid
|
||||
*
|
||||
* @return string;
|
||||
*/
|
||||
function getArchiveUrlByCid($aid,$cid=0)
|
||||
{
|
||||
if(empty($aid) || !is_numeric($aid))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
$ecField = array($aid);
|
||||
$wheresql = "";
|
||||
|
||||
if(!empty($cid) && is_numeric($cid))
|
||||
{
|
||||
$wheresql = " AND c.id=? ";
|
||||
$ecField[] = $cid;
|
||||
}
|
||||
|
||||
$sql = "SELECT arc.id,c.id as cid,c.title,c.code,c.ptype FROM ".$this->tbl_archives." arc
|
||||
LEFT JOIN ".$this->tbl_catalog." ct ON arc.id=ct.aid
|
||||
LEFT JOIN ".$this->tbl_categorys." c ON ct.cid = c.id
|
||||
WHERE arc.id=? $wheresql
|
||||
LIMIT 1";
|
||||
$sth = $this->db->prepare($sql);
|
||||
$sth->execute($ecField);
|
||||
$row = $sth->fetch();
|
||||
|
||||
$url_parts = array(
|
||||
"ptype"=>$row['ptype'],
|
||||
"type_code"=>$row['code'],
|
||||
"archive_id"=>$row['id']
|
||||
);
|
||||
|
||||
return array(
|
||||
'archive_url'=>$this->makeArchiveUrl($url_parts),
|
||||
'type_title'=>$row['title'],
|
||||
'type_id'=>$row['cid'],
|
||||
'type_url'=>$this->makeCategoryUrl($url_parts),
|
||||
);
|
||||
|
||||
}//getArchiveUrlByCid()
|
||||
|
||||
function getArchive($code='')
|
||||
{
|
||||
$sql = "select a.* from ".$this->tbl_archives." a
|
||||
left join ".$this->tbl_catalog." ac on a.id=ac.aid
|
||||
left join ".$this->tbl_categorys." c on ac.cid=c.id ";
|
||||
if (!empty($code)) $sql.=" where c.code='".$code."'";
|
||||
$rs=$this->db->query($sql);
|
||||
$rows=$rs->fetchAll();
|
||||
return $rows;
|
||||
}
|
||||
|
||||
function getOneArchive($title,$ptype='news')
|
||||
{
|
||||
$sql="update ".$this->tbl_archives." set click=click+1";
|
||||
$this->db->query($sql);
|
||||
$sql = "select a.* from ".$this->tbl_archives." a
|
||||
left join ".$this->tbl_catalog." ac on a.id=ac.aid
|
||||
left join ".$this->tbl_categorys." c on ac.cid=c.id ";
|
||||
$sql.=" where a.title=? and c.ptype=?";
|
||||
$sth=$this->db->prepare($sql);
|
||||
$sth->execute(array($title,$ptype));
|
||||
$rows=$sth->fetch();
|
||||
return $rows;
|
||||
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue