在首页上添加列表新闻

This commit is contained in:
Li Jianxuan 2012-12-31 03:48:10 +00:00
parent 90895ab827
commit 6d73b502b2
3 changed files with 29 additions and 22 deletions

View File

@ -68,7 +68,22 @@ class IndexController extends Zend_Controller_Action
}
$this->view->news = $rows;
$time = date("Y-m-d H:i:s",time());
$sql = "SELECT * FROM archive WHERE is_pub=true AND ts_published<'$time' LIMIT 8";
$sth = $this->db->query($sql);
$rows = $sth->fetchAll(PDO::FETCH_BOTH);
foreach($rows as $k=>$v)
{
$url = $News->getArchiveUrlByCid($v['id']);
$rows[$k]['url'] = $url['archive_url'];
$rows[$k]['type_title'] = $url['type_title'];
$rows[$k]['type_url'] = $url['type_url'];
}
$this->view->list_news = $rows;
}
}

View File

@ -123,28 +123,16 @@
</div>
</div>
<div id="itemCd">
<div class="alpha-shadow" id="image"><img src="<?= $this->datasetcd['img']; ?>" /></div>
<div id="title"><?= $this->datasetcd['title']; ?></div>
<div id="descript"><span id="intro">简介:</span><?= $this->datasetcd['descript']; ?></div>
<div id="link">
&nbsp;&nbsp; <a href="/data/<?php echo $this->datasetcd['uuid']; ?>">详细元数据</a>
&nbsp;|&nbsp;<a href='<?= $this->datasetcd['document']; ?>' >此数据集的数据文档</a>&nbsp;|&nbsp;<a href="/data/datasetcd">更多特色数据集&gt;&gt;</a>
</div>
<ul class="news-list">
<?php
foreach($this->list_news as $k=>$v)
{
echo '<li>[<a href="'.$v['type_url'].'">'.$v['type_title'].'</a>] <a href="'.$v['url'].'">'.$v['title'].'</a><span>['.date("Y-m-d",strtotime($v['ts_published'])).']</span></li>';
}
?>
</ul>
</div>
<div class="service_title">数据服务</div>
<div class="services_Item">
<a href="/data/newsletter">数据通讯</a>&nbsp;
<span>不定期发布数据通讯,通告中心动态、最新数据和工具</span><br />
-<span><a href='/images/newsletter/<?php echo $this->newsletter; ?>' target="_blank"><?php echo $this->newsletterno; ?>期数据通讯</a>
(pdf)</a> </span><br />
</div>
<div class="services_Item">
<a href="/knowledge">文献服务</a>&nbsp;
<span>数据中心依托中科院资环信息中心提供西部环境与生态文献和文档服务</span>
</div>
<div class="services_Item">
<a href="/data/service">用户服务</a><br />
-<span><a href="/data/offlineapp">最近20条离线数据服务记录</a></span><span>(共<?= $this->offlinenum; ?>)</span><br />

View File

@ -149,4 +149,8 @@ dd,dt{margin:0;}
#slides .pagination li.current{background:#444;}
#slides .pagination li.current a{color:#FFF}
#slides a.prev{position:relative;left:0px;top:-146px;z-index:999;}
#slides a.next{position:relative;left:475px;top:-146px;z-index:999;}
#slides a.next{position:relative;left:475px;top:-146px;z-index:999;}
.news-list{width:520px; overflow:hidden}
.news-list li{overflow:hidden; border-bottom:1px dotted #ccc;line-height:20px;}
.news-list li span{float:right;width:100px;}