Example #1
0
 public function actionList($type)
 {
     $articleQuery = Kiwi::getArticle()->find()->where(['type' => $type])->orderBy(['updated_at' => SORT_DESC]);
     $countQuery = clone $articleQuery;
     $pages = new Pagination(['totalCount' => $countQuery->count(), 'pageSize' => '4']);
     $articleModels = $articleQuery->offset($pages->offset)->limit($pages->limit)->all();
     return $this->render('list', ['articleModels' => $articleModels, 'pages' => $pages]);
 }
Example #2
0
 public function getModel()
 {
     return Kiwi::getArticle();
 }
Example #3
0
                        <p class="interview-link"><a href="<?php 
    echo Yii::$app->urlManager->createUrl(['page', 'key' => $article->key]);
    ?>
">【查看详情】</a>&nbsp;&nbsp;<a href="<?php 
    echo Url::to(['article/list', 'type' => 'text']);
    ?>
">【往期回顾】</a></p>
                    </li>
                </ul>
            <?php 
}
?>
        </div>
        <div role="tabpanel" class="tab-pane" id="mv">
            <?php 
$articles = Kiwi::getArticle()->find()->where(['type' => 'mv'])->orderBy(['updated_at' => SORT_DESC])->limit(2)->all();
foreach ($articles as $article) {
    $pictures = explode(',', $article->pictures);
    ?>
                <ul class="col-sm-6 interview-content">
                    <li class="col-xs-5">
                        <a href="<?php 
    echo Yii::$app->urlManager->createUrl(['page', 'key' => $article->key]);
    ?>
"><img width="200" height="200" <?php 
    if (!$article->pictures) {
        ?>
data-src="holder.js/200x200/text:人物" <?php 
    }
    ?>
src="<?php