diff --git a/application/admin/controllers/NewsController.php b/application/admin/controllers/NewsController.php index 3377344d..86ea4040 100644 --- a/application/admin/controllers/NewsController.php +++ b/application/admin/controllers/NewsController.php @@ -14,20 +14,15 @@ class Admin_NewsController extends Zend_Controller_Action } function indexAction() { - $sql = "select n.*,c.title as catlog,u.realname as author from news_archives n - left join news_category c on n.typeid=c.id - LEFT JOIN users u ON n.userid=u.id - order by n.ts_created desc limit 10"; - $rs = $this->db->query($sql); - $rows = $rs->fetchAll(); - $this->view->news = $rows; + include_once("news.php"); + $News = new news($this->db); - $sql = "SELECT count(id) as c FROM news_archives"; + $sql = "SELECT count(id) as c FROM ".$News->tbl_archives; $rs = $this->db->query($sql); $row = $rs->fetch(); $this->view->totle = $row; - $sql = "SELECT count(id) as c FROM news_category"; + $sql = "SELECT count(id) as c FROM ".$News->tbl_categorys; $rs = $this->db->query($sql); $row = $rs->fetch(); $this->view->typec = $row; @@ -66,10 +61,10 @@ class Admin_NewsController extends Zend_Controller_Action Zend_View_Helper_PaginationControl::setDefaultViewPartial('pagination_param.phtml'); $this->view->paginator=$paginator; - - - $this->view->types=$News->getAllCategory(); + $category = new Category($this->db); + $this->view->types= $category->GetCategory(); $this->view->type = $type; + $this->view->deepField = $category->DeepTitle; }//newslistAction 新闻列表 function catlogAction() @@ -89,7 +84,11 @@ class Admin_NewsController extends Zend_Controller_Action $this->view->ptype = $News->ptype; $this->_helper->viewRenderer('category-add'); - $this->view->categories = $News->getAllCategory(); + + $category = new Category($this->db); + $catlogs = $category->GetCategory(); + $this->view->categories=$catlogs; + $this->view->deepField = $category->DeepTitle; if(empty($submit)){ @@ -103,6 +102,7 @@ class Admin_NewsController extends Zend_Controller_Action $data['code'] = $this->_request->getParam('code'); $data['fid'] = $this->_request->getParam('fid'); $data['ptype'] = $this->_request->getParam('ptype'); + $data['is_pub'] = 1; $this->view->info = $data; @@ -125,7 +125,13 @@ class Admin_NewsController extends Zend_Controller_Action return true; } - if($this->db->insert($News->tbl_categorys,$data)) + $LftRgt = $category->Insert($data['fid']); + $data['tid'] = $data['fid']; + $data['lft'] = $LftRgt['left']; + $data['rgt'] = $LftRgt['right']; + unset($data['fid']); + + if($this->db->insert($category->CategoryTable,$data)) { $this->view->msg = '提示信息:栏目添加成功!'; $this->view->jump_url = '/admin/news/catlog'; @@ -155,8 +161,10 @@ class Admin_NewsController extends Zend_Controller_Action $this->_helper->viewRenderer('category-edit'); $this->view->ptype = $News->ptype; - $this->view->info = $News->getCategory($edit); - $this->view->categories = $this->getAllcategory($edit); + $category = new Category($this->db); + $this->view->info = $category->GetOne($edit); + $this->view->categories = $category->GetCategory(); + $this->view->deepField = $category->DeepTitle; if(!empty($submit)) { @@ -165,7 +173,7 @@ class Admin_NewsController extends Zend_Controller_Action $data['title'] = $this->_request->getParam('ctitle'); $data['code'] = $this->_request->getParam('code'); - $data['fid'] = $this->_request->getParam('fid'); + //$data['fid'] = $this->_request->getParam('fid'); $data['ptype'] = $this->_request->getParam('ptype'); $data['is_pub'] = $this->_request->getParam('is_pub'); @@ -206,20 +214,10 @@ class Admin_NewsController extends Zend_Controller_Action else { include_once("news.php"); - $news = new news($this->db); - $catlogs = $news->getAllCategory(-1); - /* - $sql="select * from news_category WHERE fid=0 order by displayorder asc"; - $re=$this->db->query($sql); - $catlogs=$re->fetchAll(); - - foreach($catlogs as $k=>$v) - { - $catlogs[$k]['sub'] = $this->getSubCategory($v['id']); - } - */ + $category = new Category($this->db); + $catlogs = $category->GetCategory(); $this->view->catlogs=$catlogs; - + $this->view->deepField = $category->DeepTitle; }//栏目列表 @@ -266,11 +264,46 @@ class Admin_NewsController extends Zend_Controller_Action function newsaddAction() { include_once("news.php"); - $News = new news($this->db); - $this->view->types=$News->getAllCategory(); + $category = new Category($this->db); + $catlogs = $category->GetCategory(); + $this->view->types=$catlogs; + $this->view->deepField = $category->DeepTitle; }//newsadd 新闻添加 + + //文档编辑 + function newseditAction() + { + include_once("news.php"); + $News = new news($this->db); + + $id = $this->_request->getParam('id'); + $this->view->typeid = $id; + + $sql = "select arc.*,ct.cid as typeid from ".$News->tbl_archives." arc + LEFT JOIN ".$News->tbl_catalog." ct ON arc.id=ct.aid + where arc.id=$id"; + $rs = $this->db->query($sql); + $row = $rs->fetch(); + + $this->view->ev = $row; + + if(!empty($row['image'])) + { + $sql = "SELECT * FROM attachments WHERE filename='".str_replace("/upload/",'',$row['image'])."'"; + $rs = $this->db->query($sql); + $row = $rs->fetch(); + $this->view->att = $row; + } + + $this->view->keywords = join(",",$News->GetTags($id)); + + $category = new Category($this->db); + $catlogs = $category->GetCategory(); + $this->view->types=$catlogs; + $this->view->deepField = $category->DeepTitle; + } - //新闻添加 + //文档编辑或者添加 function archivesaddAction() { $this->_helper->layout->disableLayout(); @@ -351,15 +384,24 @@ class Admin_NewsController extends Zend_Controller_Action ); $update = $this->_getParam('update'); - $aid = $this->_getParam('aid'); - if(is_numeric($update) && !empty($update) && !empty($aid)) + if(is_numeric($update) && !empty($update)) { - if($this->db->update($News->tbl_archives,$data[],"id=$aid")) + $sql = "UPDATE ".$News->tbl_archives." SET + userid=".$data['userid'].", + title=".$data['title'].", + description=".$data['description'].", + image=".$data['image'].", + source=".$data['source'].", + ts_published=".$data['ts_published'].", + is_pub=".$data['is_pub'].", + body=".$data['body']." + WHERE id=$update"; + if($this->db->exec($sql)) { - $News->ChangeCatalog($aid,$typeid); - $News->DeleteTags($aid); - $News->MakeTags($aid,$keyword); + $News->ChangeCatalog($update,$typeid); + $News->DeleteTags($update); + $News->MakeTags($update,$keyword); echo '
修改成功!
'; @@ -411,37 +453,6 @@ class Admin_NewsController extends Zend_Controller_Action } }// 文章发布 - //文档编辑 - function newseditAction() - { - include_once("news.php"); - $News = new news($this->db); - - $id = $this->_request->getParam('id'); - - $sql = "select * from ".$News->tbl_archives." arc where arc.id=$id"; - $rs = $this->db->query($sql); - $row = $rs->fetch(); - - $this->view->ev = $row; - - if(!empty($row['image'])) - { - $sql = "SELECT * FROM attachments WHERE filename='".str_replace("/upload/",'',$row['image'])."'"; - $rs = $this->db->query($sql); - $row = $rs->fetch(); - $this->view->att = $row; - } - - $this->view->keywords = join(",",$News->GetTags($id)); - - $sql="select * from ".$News->tbl_categorys." order by displayorder desc"; - $re = $this->db->query($sql); - $types = $re->fetchAll(); - - $this->view->types=$types; - } - function deleteAction(){ $id = $this->_request->getParam('id'); diff --git a/application/admin/views/scripts/news/category-add.phtml b/application/admin/views/scripts/news/category-add.phtml index 7a5dabc8..6806876f 100644 --- a/application/admin/views/scripts/news/category-add.phtml +++ b/application/admin/views/scripts/news/category-add.phtml @@ -57,11 +57,17 @@ categories)) :?> categories as $v) : ?> info['fid'])) {?> - + info['fid'] == $v['id']) { ?> - +

-

-
- -

-


(仅小写英文字母与数字) diff --git a/application/admin/views/scripts/news/catlog.phtml b/application/admin/views/scripts/news/catlog.phtml index c2d3fc84..4728d7d2 100644 --- a/application/admin/views/scripts/news/catlog.phtml +++ b/application/admin/views/scripts/news/catlog.phtml @@ -49,12 +49,16 @@ $deep = 0; foreach($this->catlogs as $k=>$v) { - if($v['fid']==0) + if($v[$this->deepField]>0) { - echo ' + $style = "text-indent:". $v[$this->deepField]*12 ."px;"; + }else{ + $style = ""; + } + echo ' -

+
'.$v['title'].' @@ -63,37 +67,6 @@ 编辑 删除 '; - $top = $v['id']; - } - - foreach($this->catlogs as $vv) - { - $fid = $vv['fid']; - if(!empty($top) || !empty($fid)) - { - if($top != $fid) - { - $deep ++; - }else{ - $deep = 1; - } - if($vv['tid']==$top) - { - echo ' - - -
'; - echo '- '.$vv['title'].' - - - 浏览 - 文档 - 编辑 - 删除 - '; - } - } - } } }else{ diff --git a/application/admin/views/scripts/news/index.phtml b/application/admin/views/scripts/news/index.phtml index 59d0fd34..147fcf0f 100644 --- a/application/admin/views/scripts/news/index.phtml +++ b/application/admin/views/scripts/news/index.phtml @@ -3,7 +3,7 @@ $this->headTitle('后台管理'); $this->headTitle()->setSeparator(' - '); $this->headScript()->appendFile('/js/jquery-1.7.min.js'); - $this->headLink()->appendStylesheet('/css/admin.css'); + $this->headLink()->appendStylesheet('/css/admin.css'); $this->breadcrumb('首页'); $this->breadcrumb('后台首页'); $this->breadcrumb('新闻中心'); @@ -25,59 +25,6 @@
- -

最新发布的新闻

-
- - - - - - - - - - news)) - { - foreach ($this->news as $v) - { - echo ' - - - - - - '; - } - } - else - { - echo ' - - '; - } - ?> - - -
新闻标题所属栏目新闻管理
-
- '.$v['title'].' -
-
- 详细信息 关闭 -

作者:'.$v['author'].'

-

关键词:'.$v['keywords'].'

-

描述:'.$v['description'].'

-

添加时间:'.date("Y-m-d H:i",strtotime($v['ts_created'])).'

-

发布时间:'.date("Y-m-d H:i",strtotime($v['ts_published'])).'

-

来源:'.$v['source'].'

-

点击:'.$v['click'].'

-
-
-
'.$v['catlog'].' - 编辑 - 删除
暂无数据

统计


diff --git a/application/admin/views/scripts/news/newsadd.phtml b/application/admin/views/scripts/news/newsadd.phtml index 479d614e..9e135151 100644 --- a/application/admin/views/scripts/news/newsadd.phtml +++ b/application/admin/views/scripts/news/newsadd.phtml @@ -112,7 +112,9 @@ $(document).ready(function(){ types as $v) { - echo ''; + if(!empty($v[$this->deepField])) {$haed = str_repeat('-',$v[$this->deepField]);} + echo ''; + $haed = ""; } ?> diff --git a/application/admin/views/scripts/news/newsedit.phtml b/application/admin/views/scripts/news/newsedit.phtml index 2a278065..18d87b6e 100644 --- a/application/admin/views/scripts/news/newsedit.phtml +++ b/application/admin/views/scripts/news/newsedit.phtml @@ -130,10 +130,15 @@ $(document).ready(function(){ types as $v) { + $haed = ""; + if(!empty($v[$this->deepField])) {$haed = str_repeat('-',$v[$this->deepField]);} + if($this->ev['typeid']==$v['id']) - echo ''; + echo ''; else - echo ''; + echo ''; + + $haed = ""; } ?> @@ -144,9 +149,8 @@ $(document).ready(function(){

@@ -201,7 +205,7 @@ function addon(){ } } editor.sync(); - var url = "/admin/news/archivesedit/id/ev['id']; ?>"; + var url = "/admin/news/archivesadd/update/ev['id']; ?>"; var data = $("#archivesadd").serialize()+'&keyword='+$('#keyword').val(); $.ajax({ type: "POST", diff --git a/application/admin/views/scripts/news/newslist.phtml b/application/admin/views/scripts/news/newslist.phtml index 5e80519d..d92834f3 100644 --- a/application/admin/views/scripts/news/newslist.phtml +++ b/application/admin/views/scripts/news/newslist.phtml @@ -40,10 +40,13 @@ $('#divFooter').css('position','absolute'); { foreach($this->types as $v) { + if(!empty($v[$this->deepField])) {$haed = str_repeat('-',$v[$this->deepField]);} if($this->type == $v['id']) - echo ''; + echo ''; else - echo ''; + echo ''; } } ?> diff --git a/application/default/controllers/NewsController.php b/application/default/controllers/NewsController.php index 664f307c..c63d6ac7 100644 --- a/application/default/controllers/NewsController.php +++ b/application/default/controllers/NewsController.php @@ -14,13 +14,13 @@ class NewsController extends Zend_Controller_Action { include_once("news.php"); $News = new news($this->db); - $types = $News->getAllCategory(); - - $this->view->types=$types; + $category = new Category($this->db); + $this->view->types = $category->GetCategory(); + $this->view->deepField = $category->DeepTitle; $time = date("Y-m-d H:i:s",time()); - $sql = "SELECT id,title,code FROM ".$News->tbl_categorys." WHERE fid=0"; + $sql = "SELECT id,title,code FROM ".$News->tbl_categorys.""; $sth = $this->db->query($sql); $rows = $sth->fetchAll(); @@ -38,7 +38,7 @@ class NewsController extends Zend_Controller_Action $rs = $this->db->query($sql); $archives = $rs->fetchAll(); - $newslist[$v['id']] = array("title"=>$v['title'],"url"=>$v['code'],"id"=>$v['id'],"list"=>$archives); + $newslist[$v['id']] = array("title"=>$v['title'],"code"=>$v['code'],"id"=>$v['id'],"list"=>$archives); } $this->view->lists = $newslist; @@ -78,12 +78,10 @@ class NewsController extends Zend_Controller_Action $this->view->url = $row['code']; $this->view->title = $row['title']; - - include_once("news.php"); - $news = new news($this->db); - $types = $news->getAllCategory(); - - $this->view->types=$types; + + $category = new Category($this->db); + $this->view->types = $category->GetCategory(); + $this->view->deepField = $category->DeepTitle; $time = date("Y-m-d H:i:s",time()); @@ -122,9 +120,9 @@ class NewsController extends Zend_Controller_Action include_once("news.php"); $News = new news($this->db); - $types = $News->getAllCategory(); - - $this->view->types=$types; + $category = new Category($this->db); + $this->view->types = $category->GetCategory(); + $this->view->deepField = $category->DeepTitle; $time = date("Y-m-d H:i:s",time()); diff --git a/application/default/views/scripts/news/archive.phtml b/application/default/views/scripts/news/archive.phtml index 7d9b9b6d..6e02cde1 100644 --- a/application/default/views/scripts/news/archive.phtml +++ b/application/default/views/scripts/news/archive.phtml @@ -25,17 +25,10 @@ $this->headMeta()->appendName('description', mb_substr($this->infos['description { foreach($this->types as $k=>$v) { - if($v['fid']==0) - { - echo '
  • '.$v['title'].'
  • '; - } - foreach($this->types as $vd) - { - if($vd['fid']==$v['id']) - { - echo '
  • - '.$vd['title'].'
  • '; - } - } + $haed = ""; + if(!empty($v[$this->deepField])) {$haed = str_repeat(' ',$v[$this->deepField]);} + echo '
  • '.$haed.$v['title'].'
  • '; + $haed = ""; } } ?> diff --git a/application/default/views/scripts/news/index.phtml b/application/default/views/scripts/news/index.phtml index eb1ccafb..d249f85d 100644 --- a/application/default/views/scripts/news/index.phtml +++ b/application/default/views/scripts/news/index.phtml @@ -19,17 +19,10 @@ $this->breadcrumb()->setSeparator(' > '); { foreach($this->types as $k=>$v) { - if($v['fid']==0) - { - echo '
  • '.$v['title'].'
  • '; - } - foreach($this->types as $vd) - { - if($vd['fid']==$v['id']) - { - echo '
  • - '.$vd['title'].'
  • '; - } - } + $haed = ""; + if(!empty($v[$this->deepField])) {$haed = str_repeat(' ',$v[$this->deepField]);} + echo '
  • '.$haed.$v['title'].'
  • '; + $haed = ""; } } ?> @@ -43,12 +36,12 @@ $this->breadcrumb()->setSeparator(' > '); {?> 0) {?>
    -
    +
      -
    • +
    diff --git a/application/default/views/scripts/news/list.phtml b/application/default/views/scripts/news/list.phtml index 8d1be338..7444cc1c 100644 --- a/application/default/views/scripts/news/list.phtml +++ b/application/default/views/scripts/news/list.phtml @@ -20,17 +20,10 @@ $this->breadcrumb()->setSeparator(' > '); { foreach($this->types as $k=>$v) { - if($v['fid']==0) - { - echo '
  • '.$v['title'].'
  • '; - } - foreach($this->types as $vd) - { - if($vd['fid']==$v['id']) - { - echo '
  • - '.$vd['title'].'
  • '; - } - } + $haed = ""; + if(!empty($v[$this->deepField])) {$haed = str_repeat(' ',$v[$this->deepField]);} + echo '
  • '.$haed.$v['title'].'
  • '; + $haed = ""; } } ?> diff --git a/application/models/news.php b/application/models/news.php index 5d57987f..d387d0b3 100644 --- a/application/models/news.php +++ b/application/models/news.php @@ -1,4 +1,13 @@ "faq" ); }//ptype() - - /* - 递归获得所有栏目 - */ - function getAllCategory($hide = true){ - - if($hide == -1) - { - $sql = "SELECT c.* FROM ".$this->tbl_categorys." c - ORDER BY displayorder asc"; - }else{ - $sql = "SELECT c.* FROM ".$this->tbl_categorys." c - WHERE is_pub = $hide - ORDER BY displayorder asc"; - } - - $re = $this->db->query($sql); - $categorys = $re->fetchAll(); - - return $categorys; - } - - //取得最顶级的栏目 - function getTopType(){ - $sql = "SELECT c.* FROM ".$this->tbl_categorys." c - WHERE is_pub = true AND fid=0 - ORDER BY displayorder asc"; - $re = $this->db->query($sql); - $categorys = $re->fetchAll(); - return $categorys; - } - - //获得栏目 - function getCategory($id) - { - $sql = "SELECT * FROM ".$this->tbl_categorys." WHERE id=?"; - $sth = $this->db->prepare($sql); - $sth->execute(array($id)); - $rows = $sth->fetch(); - return $rows; - } /* 写入关系表 @@ -108,9 +76,6 @@ class news /* * 更改栏目 ChangeCatalog() - * - * - * */ function ChangeCatalog($aid,$cid,$uuid='',$status=0){ @@ -134,7 +99,7 @@ class news $data['uuid'] = $uuid; } - if($this->db->update($this->tbl_catalog,$data,"id=$aid")) + if($this->db->update($this->tbl_catalog,$data,"aid=$aid")) { return true; }else{ @@ -262,5 +227,238 @@ class news $sql = "DELETE FROM ".$this->tbl_tag." WHERE id=$aid"; @$this->db->exec($sql); return true; + }//DeleteTags + +} + +class Category +{ + //PDO对象 + private $db; + + //数据库中分类表 + public $CategoryTable; + + //分类左值字段名称 + private $fld_left; + + //分类右值字段名称 + private $fld_right; + + //顶级栏目标记字段 + private $fld_tid; + + //输出栏目中的深度信息 + public $DeepTitle; + + function __construct($db){ + $this->db = $db; + $this->CategoryTable = "ar_category"; + $this->fld_left = "lft"; + $this->fld_right = "rgt"; + $this->fld_tid = "tid"; + $this->DeepTitle = "DEEP"; } + + /** + * GetTree() 获得栏目树 + * 用来获得某个栏目下或者所有栏目的树结构 + * + * 典型表结构 + * (PostgreSql) + * + CREATE TABLE ar_category + ( + id serial NOT NULL, + title character varying(80), + tid integer NOT NULL DEFAULT 0, + lft integer NOT NULL DEFAULT 0, + rgt integer NOT NULL DEFAULT 0, + CONSTRAINT ar_category_pkey PRIMARY KEY (id) + ) + * + * @param int $tid + * + * @return array; + */ + function GetCategory($tid=0){ + + $left = $this->fld_left; + $right = $this->fld_right; + $categoryTable = $this->CategoryTable; + $tidField = $this->fld_tid; + + $whereSql = array(); + + if(!empty($tid)) + { + $sql = "SELECT $left,$right FROM $categoryTable + WHERE id=$tid"; + $sth = $this->db->query($sql); + $row = $sth->fetch(); + $whereSql[] = " $left BETWEEN {$row[$left]} AND {$row[$right]} "; + } + + if(count($whereSql)>0) + { + $whereSql = " WHERE ".join(" AND ",$whereSql); + }else{ + $whereSql = ""; + } + + + $sql = "SELECT * + FROM $categoryTable + $whereSql + ORDER BY $left ASC "; + $sth = $this->db->query($sql); + $rows = $sth->fetchAll(); + + $stack = array(); + $categorys = array(); + + foreach($rows as $k=>$v) + { + /* + 如果它是一个顶级栏目,则为它重置深度 + */ + if(empty($v[$tidField])) + { + $stack = array(); + }else{ + if(count($stack) > 1) + { + /* + 在这个循环中必须追溯直至与其平级的分类 + while循环无法重写条件中已经改变的变量 + 第一次max(array_keys($stack))赋值为当前深度 + 循环中的第一个if里max(array_keys($stack))是重新统计,而非使用一定义的 + 因为第二次循环到此时可能max(array_keys($stack))已经发生改变 + 第三处max(array_keys($stack))表示第一个if中没有break掉的深度值,所以也不能使用赋过值的变量代替。 + + 加入brake 可使程序追溯至平级栏目即进行下一步操作 + 必须是倒序循环,多个平级栏目时,如果是正序列循环会到第一个平级的栏目后停止循环 + */ + for($i=max(array_keys($stack));$i>=0;$i--) + if($v[$right]>$stack[max(array_keys($stack))]) + { + if(count($stack)<1) + { + break; + } + if($v[$right]>$stack[max(array_keys($stack))]) + { + array_pop($stack); + }else{ + break; + } + }//end if + }//end if + } + + //放入输出数组 + $rows[$k][$this->DeepTitle] = count($stack); + + //将此节点加入栈中 + $stack[] = $v[$right]; + + }// end foreach + + return $rows; + + } + + /** + * Insert() 插入一个栏目 + * 返回数组 left=>左值 right=>右值 + * + * + * @param int $tid + * + * @return array + */ + function Insert($tid){ + + $left = $this->fld_left; + $right = $this->fld_right; + $categoryTable = $this->CategoryTable; + + //分别处理有上级栏目和没上级栏目的 + if(!empty($tid)) + { + $sql = "SELECT $right + FROM $categoryTable + WHERE id=$tid"; + $sth = $this->db->query($sql); + $row = $sth->fetch(); + $right_start = $row[$right]-1; + + //更新所有右值 + $sql = "UPDATE $categoryTable SET $right=$right+2 WHERE $right>$right_start"; + $this->db->exec($sql); + + //更新所有左值 + $sql = "UPDATE $categoryTable SET $left=$left+2 WHERE $left>$right_start"; + $this->db->exec($sql); + + //返回应该插入的左右值 + $lft = $right_start + 1; + $rgt = $lft + 1; + return array( + 'left'=>$lft, + 'right'=>$rgt + ); + + }else{ + //取最大的右值 + $sql = "SELECT $right + FROM $categoryTable + WHERE tid=0 + ORDER BY $left DESC LIMIT 1"; + + $sth = $this->db->query($sql); + $row = $sth->fetch(); + $right_start = $row[$right]-1; + + if($right_start<1) + { + return array( + 'left'=>1, + 'right'=>2 + ); + } + + $lft = $right_start + 2; + $rgt = $lft + 1; + return array( + 'left'=>$lft, + 'right'=>$rgt + ); + } + + }//Insert + + //获取栏目路径 + function GetRouter($lft,$rgt){ + $sql = "SELECT * FROM ".$this->CategoryTable." + WHERE ".$this->fld_left." < $lft AND ".$this->fld_right." > $rgt + ORDER BY ".$this->fld_left." ASC;"; + $sth = $this->db->query($sql); + $rows = $sth->fetchAll(); + return $rows; + } + + function GetSunCount($left,$right){ + return ($right-$left-1)/2; + } + + //获取一个栏目 + function GetOne($tid){ + + $sql = "SELECT * FROM ".$this->CategoryTable." WHERE id=$tid"; + $sth = $this->db->query($sql); + return $sth->fetch(); + + }//GetOne + } \ No newline at end of file diff --git a/htdocs/css/news.css b/htdocs/css/news.css index 0e01267f..baa4a56c 100644 --- a/htdocs/css/news.css +++ b/htdocs/css/news.css @@ -35,7 +35,7 @@ .archive_body div.info{text-align:center;padding:10px 0;} .archive_body div.content{word-break:break-all;word-wrap:break-word;overflow:hidden;} -.list-archives{width:300px;overflow:hidden;} +.list-archives{width:300px;overflow:hidden;margin:5px;float:left;} .list-archives .list-title{width:100%;overflow:hidden;background:#F60;text-indent:12px;} .list-archives .list-title a {color:#FFF;line-height:30px;font-size:14px;} .list-archives .list-content{border:1px solid #F60;}