修正首页doi显示的年份问题

This commit is contained in:
wlx 2013-05-20 13:44:40 +00:00
parent c1803dac86
commit 220dfb4549
2 changed files with 2 additions and 2 deletions

View File

@ -85,7 +85,7 @@ class IndexController extends Zend_Controller_Action
$this->view->list_news = $rows;
$sql="select * from datadoi where ts_published is not null order by ts_published desc limit 4";
$sql="select d.*,m.ts_published as publish_year from datadoi d left join metadata m on d.uuid=m.uuid where d.ts_published is not null order by ts_published desc limit 4";
$sth = $this->db->query($sql);
$this->view->dois = $sth->fetchAll();

View File

@ -79,7 +79,7 @@
<h4><a href="/data/doi">最新DOI数据</a></h4>
<ul class="unstyled">
<?php foreach($this->dois as $doi) :
echo '<li class="well well-small"><a href="/data/'.$doi->uuid.'">'.substr($doi->authors,1,-1).'. '.$doi->title.'. '.$doi->publisher.', '.date('Y',strtotime($doi->ts_published)).'. doi:'.$doi->doi.'</a></li>';
echo '<li class="well well-small"><a href="/data/'.$doi->uuid.'">'.substr($doi->authors,1,-1).'. '.$doi->title.'. '.$doi->publisher.', '.(empty($doi->publish_year)?date('Y',strtotime($md->ts_published)):date('Y',strtotime($doi->publish_year))).'. doi:'.$doi->doi.'</a></li>';
//echo ' ['.str_replace('"','',substr($md->author_en,1,-1)).'. '.$md->title_en.'. '.$md->publisher_en.', '.$md->publish_year.'. doi:'.$md->doi.']';
endforeach;
?>