Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

recommend empty bug. #14

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
dcms2
=====

dcms2 basic on yii2
dcms2 basic on yii2

screenshots

Expand Down
2 changes: 1 addition & 1 deletion config/db.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
'class' => 'yii\db\Connection',
'dsn' => 'mysql:host=127.0.0.1;dbname=dcms2',
'username' => 'root',
'password' => '',
'password' => '123456',
'charset' => 'utf8',
'tablePrefix' => 'tbl_',
];
2 changes: 1 addition & 1 deletion config/web.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
],
],
'urlManager' => [
'enablePrettyUrl' => true,
// 'enablePrettyUrl' => true,
'showScriptName' => false,
],
'config' => [
Expand Down
4 changes: 2 additions & 2 deletions views/site/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,14 @@
<a href="<?= Url::to(['post/view', 'id' => $headline->id]) ?>"><img src="<?= $headline->thumbnail ?>" alt="<?= Html::encode($headline->title) ?>" style="width:100%;"></a>
</div>
<?php endif ?>
<?php if ($recommend[0]): ?>
<?php if (!empty($recommend[0])): ?>
<div class="recommend clearfix">
<div class="pull-left" style="width:48%">
<h4><a href="<?= Url::to(['post/view', 'id' => $recommend[0]['id']]) ?>"><?= Html::encode($recommend[0]['title']) ?></a></h4>
<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>
<p><?= Html::encode($recommend[0]->MakeSummary) ?></p>
</div>
<?php if ($recommend[1]): ?>
<?php if (!empty($recommend[1])): ?>
<div class="pull-right" style="width:48%">
<h4><a href="<?= Url::to(['post/view', 'id' => $recommend[1]['id']]) ?>"><?= Html::encode($recommend[1]['title']) ?></a></h4>
<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>
Expand Down