コード例 #1
0
ファイル: main.php プロジェクト: Mitonios/mitonios-blog
    <?php 
$this->head();
?>
</head>
<body>
<?php 
$this->beginBody();
?>


<div class="blog-masthead">
    <div class="container">
        <nav class="blog-nav">
            <?php 
$items = [['label' => 'Home', 'url' => ['/site/index']]];
$result = Category::getDb()->cache(function ($db) {
    return Category::find()->where(['parent_id' => null])->all();
});
foreach ($result as $item) {
    $items[] = ['label' => $item->title, 'url' => ['/site/category', 'id' => $item->id]];
}
echo BootstrapBlogMenu::widget(['items' => $items]);
?>
        </nav>
    </div>
</div>
<div class="container">
    <div class="blog-header">
        <h1 class="blog-title">Mitonios Blog</h1>
        <p class="lead blog-description">Yiiframework and share some resources.</p>
    </div>