update news list

This commit is contained in:
jack 2018-02-10 15:50:09 +08:00
parent d0d129eba1
commit d1d9a20644
2 changed files with 33 additions and 23 deletions

View File

@ -122,34 +122,44 @@
<div class="col-xs-6 news-con"> <div class="col-xs-6 news-con">
<?php for($i = 0; $i <= 3; $i++){ ?> <?php for($i = 0; $i <= 3; $i++){ ?>
<div class="news-wrapper"> <div class="news-wrapper">
<h5><a href="<?= $this->list_news[$i]['url'] ?>"><?= $this->list_news[$i]['title'] ?></a></h5> <div class="col-xs-2" style="background: url('<?= $this->list_news[$i]['image'] ?>') no-repeat center;background-size:contain;height: 75px"></div>
<p><?php <div class="col-xs-10">
$description = ""; <h5><a href="<?= $this->list_news[$i]['url'] ?>"><?= $this->list_news[$i]['title'] ?></a></h5>
if (mb_strlen($this->list_news[$i]['description'])>100) <p>
{ <?php
$description = mb_substr($this->list_news[$i]['description'],0,100,'utf-8').'...'; $description = "";
}else{ if (mb_strlen($this->list_news[$i]['description'])>80)
$description = $this->list_news[$i]['description']; {
} $description = mb_substr($this->list_news[$i]['description'],0,80,'utf-8').'...';
echo $description; ?> }else{
</p> $description = $this->list_news[$i]['description'];
}
echo $description; ?>
</p>
</div>
<p style="clear: both"></p>
</div> </div>
<?php } ?> <?php } ?>
</div> </div>
<div class="col-xs-6 news-con"> <div class="col-xs-6 news-con">
<?php for($i = 4; $i <= 7; $i++){ ?> <?php for($i = 4; $i <= 7; $i++){ ?>
<div class="news-wrapper"> <div class="news-wrapper">
<h5><a href="<?= $this->list_news[$i]['url'] ?>"><?= $this->list_news[$i]['title'] ?></a></h5> <div class="col-xs-2" style="background: url('<?= $this->list_news[$i]['image'] ?>') no-repeat center;background-size:contain;height: 75px"></div>
<p><?php <div class="col-xs-10">
$description = ""; <h5><a href="<?= $this->list_news[$i]['url'] ?>"><?= $this->list_news[$i]['title'] ?></a></h5>
if (mb_strlen($this->list_news[$i]['description'])>100) <p>
{ <?php
$description = mb_substr($this->list_news[$i]['description'],0,100,'utf-8').'...'; $description = "";
}else{ if (mb_strlen($this->list_news[$i]['description'])>80)
$description = $this->list_news[$i]['description']; {
} $description = mb_substr($this->list_news[$i]['description'],0,80,'utf-8').'...';
echo $description; ?> }else{
</p> $description = $this->list_news[$i]['description'];
}
echo $description; ?>
</p>
</div>
<p style="clear: both"></p>
</div> </div>
<?php } ?> <?php } ?>
</div> </div>

View File

@ -164,7 +164,7 @@ h1{
margin-top: 50px; margin-top: 50px;
} }
.news-wrapper a{ .news-wrapper a{
color:#333; color:#333;
} }
.news .hicon{ .news .hicon{
display: inline-block; display: inline-block;