在前台添加新闻中心

This commit is contained in:
Li Jianxuan 2012-11-05 08:39:15 +00:00
parent ee26d4d361
commit 915a6188b4
4 changed files with 15 additions and 7 deletions

View File

@ -52,7 +52,7 @@ class NewsController extends Zend_Controller_Action
$this->_forward('error', 'error', null, null); $this->_forward('error', 'error', null, null);
} }
$sql = "SELECT id,url,title FROM news_category WHERE url='$type' "; $sql = "SELECT id,url,title FROM news_category WHERE url='$type' AND display>0 ";
$rs = $this->db->query($sql); $rs = $this->db->query($sql);
$row = $rs->fetch(); $row = $rs->fetch();
@ -72,6 +72,8 @@ class NewsController extends Zend_Controller_Action
$this->view->types=$types; $this->view->types=$types;
$time = date("Y-m-d H:i:s",time());
$sql = "SELECT arc.*,c.url FROM news_archives arc $sql = "SELECT arc.*,c.url FROM news_archives arc
left join news_category c ON arc.typeid=c.id left join news_category c ON arc.typeid=c.id
WHERE arc.typeid='{$row['id']}' AND arc.ts_published<'".$time."' AND arc.is_pub>=1 WHERE arc.typeid='{$row['id']}' AND arc.ts_published<'".$time."' AND arc.is_pub>=1
@ -114,10 +116,11 @@ class NewsController extends Zend_Controller_Action
$sql .= " LEFT JOIN news_category type ON arc.typeid=type.id"; $sql .= " LEFT JOIN news_category type ON arc.typeid=type.id";
$sql .= " LEFT JOIN users u ON arc.userid=u.id"; $sql .= " LEFT JOIN users u ON arc.userid=u.id";
$sql .= " WHERE arc.is_pub>0 AND arc.ts_published<'now()' AND arc.id=$archive"; $sql .= " WHERE arc.is_pub>0 AND arc.ts_published<'now()' AND arc.id=$archive";
/*
$sql = "SELECT arc.* FROM news_archives arc"; $sql = "SELECT arc.* FROM news_archives arc";
$sql .= " LEFT JOIN news_category type ON arc.typeid=type.id"; $sql .= " LEFT JOIN news_category type ON arc.typeid=type.id";
$sql .= " WHERE arc.is_pub>0 AND ts_published<'$time' AND arc.id=$archive"; $sql .= " WHERE arc.is_pub>0 AND ts_published<'$time' AND arc.id=$archive";
*/
$rs = $this->db->query($sql); $rs = $this->db->query($sql);
$row = $rs->fetch(); $row = $rs->fetch();

View File

@ -14,6 +14,7 @@
<li><a href="/knowledge"><span>知识积累</span></a></li> <li><a href="/knowledge"><span>知识积累</span></a></li>
<li><a href="/community"><span>合作与交流</span></a></li> <li><a href="/community"><span>合作与交流</span></a></li>
<li><a href="/about"><span>关于本站</span></a></li> <li><a href="/about"><span>关于本站</span></a></li>
<li><a href="/news"><span>新闻中心</span></a></li>
</ul> </ul>
</div> </div>
<div id="userNavi"> <div id="userNavi">

View File

@ -56,8 +56,12 @@ $this->breadcrumb()->setSeparator(' > ');
}else{ }else{
$description = $v['description']; $description = $v['description'];
} }
echo '<li> echo '<li>';
<a href="/news/'.$v['url'].'/archive-'.$v['id'].'.html" class="title">'.$v['title'].'</a><br /> if(!empty($v['image']))
{
echo '<img src="'.$v['image'].'" style="max-height:200px;float:left;" />';
}
echo '<a href="/news/'.$v['url'].'/archive-'.$v['id'].'.html" class="title">'.$v['title'].'</a><br />
<small>TIME&nbsp;:&nbsp;'.date("Y-m-d H:i",strtotime( $v['ts_published'] )).'</small> <small>TIME&nbsp;:&nbsp;'.date("Y-m-d H:i",strtotime( $v['ts_published'] )).'</small>
<p>'.$description.'</p> <p>'.$description.'</p>
</li>'; </li>';

View File

@ -43,7 +43,7 @@ a:hover,a:focus,a:active{background-color:#E2EFFF;color:#329ECC;border-bottom:1p
/*- Menu Tabs--------------------------- */ /*- Menu Tabs--------------------------- */
.nav{border-top:#5D657C 1px solid;border-bottom:#5D657C 1px solid;width:100%;overflow:hidden;height:39px;} .nav{border-top:#5D657C 1px solid;border-bottom:#5D657C 1px solid;width:100%;overflow:hidden;height:39px;}
#divNavi {font-size:14px;line-height:normal;overflow:hidden;width:680px;margin:0 auto;} #divNavi {font-size:14px;line-height:normal;overflow:hidden;width:780px;margin:0 auto;}
#divNavi ul {margin:0;padding:10px 10px 0 0px;list-style:none;overflow:hidden;} #divNavi ul {margin:0;padding:10px 10px 0 0px;list-style:none;overflow:hidden;}
#divNavi li {display:inline;margin:0;padding:0;} #divNavi li {display:inline;margin:0;padding:0;}
#divNavi a { #divNavi a {