예제 #1
0
 public function actionView($slug)
 {
     $articles = Article::getInstance()->getListByCategory($slug);
     $category = Category::getInstance()->getBySlug($slug);
     $hotArticles = Article::getInstance()->getHotListByCategory($slug, ['title', 'slug'], [], 1, 10);
     return $this->render('view', ['articles' => $articles, 'category' => $category, 'hotArticles' => $hotArticles]);
 }
예제 #2
0
파일: index.php 프로젝트: luobenyu/blog-1
    ?>
                    </div>
                </article>
            <?php 
}
?>
            <?php 
echo \yii\widgets\LinkPager::widget(['pagination' => $articles['pagination']]);
?>
        </div>
        <div class="hidden-xs col-md-3 col-lg-4">
            <div class="panel panel-default">
                <div class="panel-heading">最新指示</div>
                <div class="list-group">
                    <?php 
foreach (\common\helpers\Article::getInstance()->getList(['title', 'slug'], [], 10, 1)['data'] as $article) {
    ?>
                        <a href="<?php 
    echo \yii\helpers\Url::toRoute(['/article/view', 'slug' => $article['slug']]);
    ?>
"
                           class="list-group-item"><?php 
    echo $article['title'];
    ?>
</a>
                    <?php 
}
?>
                </div>
            </div>
            <div class="panel panel-default">