Skip to content

Commit 884b6bf

Browse files
committed
Site/Index, fix recommand empty bug.
1 parent d32abb4 commit 884b6bf

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

views/site/index.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -24,14 +24,14 @@
2424
<a href="<?= Url::to(['post/view', 'id' => $headline->id]) ?>"><img src="<?= $headline->thumbnail ?>" alt="<?= Html::encode($headline->title) ?>" style="width:100%;"></a>
2525
</div>
2626
<?php endif ?>
27-
<?php if ($recommend[0]): ?>
27+
<?php if (!empty($recommend[0])): ?>
2828
<div class="recommend clearfix">
2929
<div class="pull-left" style="width:48%">
3030
<h4><a href="<?= Url::to(['post/view', 'id' => $recommend[0]['id']]) ?>"><?= Html::encode($recommend[0]['title']) ?></a></h4>
3131
<a href="<?= Url::to(['post/view', 'id' => $recommend[0]['id']]) ?>"><img src="<?= $recommend[0]['thumbnail'] ?>" alt="<?= Html::encode($recommend[0]['title']) ?>" style="width:280px;"></a>
3232
<p><?= Html::encode($recommend[0]->MakeSummary) ?></p>
3333
</div>
34-
<?php if ($recommend[1]): ?>
34+
<?php if (!empty($recommend[1])): ?>
3535
<div class="pull-right" style="width:48%">
3636
<h4><a href="<?= Url::to(['post/view', 'id' => $recommend[1]['id']]) ?>"><?= Html::encode($recommend[1]['title']) ?></a></h4>
3737
<a href="<?= Url::to(['post/view', 'id' => $recommend[1]['id']]) ?>"><img src="<?= $recommend[1]['thumbnail'] ?>" alt="<?= Html::encode($recommend[1]['title']) ?>" style="width:280px;"></a>

0 commit comments

Comments
 (0)