?> <?php foreach ($moderate as $post) { ?> <li class="list-group-item"> Title: <a href="<?php echo Yii::$app->urlManager->createUrl(['posts/details', 'id' => $post->id]); ?> "><?php echo $post->title; ?> </a> </li> <li class="list-group-item"> Author: <?php echo Author::getAuthor($post->author_id); ?> </li> <?php } ?> <?php } else { ?> <h2 class="alert-danger">There are no posts1</h2> <?php } ?> </ul> <?php //var_dump(Author::find()->all());
<?php use common\models\Author; $this->title = 'Tags'; $this->params['breadcrumbs'][] = ['label' => 'Posts', 'url' => 'index']; $this->params['breadcrumbs'][] = ['label' => 'Tags', 'url' => 'http://admin.yiiadv/tag/index']; $this->params['breadcrumbs'][] = Yii::$app->request->get('tag'); if ($model) { ?> <ul class="list-group"> <?php foreach ($model as $item) { ?> <?php $author = Author::getAuthor($item->author_id); ?> <li class="list-group-item"> Title: <a href="<?php echo Yii::$app->urlManager->createUrl(['posts/details', 'id' => $item->id]); ?> "><?php echo $item->title; ?> </a> </li> <li class="list-group-item"> Author: <?php echo $author; ?> </li> <?php
</li> <?php } ?> </ul> <ul class="list-group"> <h1 class="page-header">Posts: <?php echo Category::findOne($_GET['category'])->name; ?> </h1> <?php foreach ($postOrders as $post) { ?> <?php $author = Author::getAuthor($post->author_id); ?> <li class="list-group-item"> Title: <a href="<?php echo Yii::$app->urlManager->createUrl(['posts/details', 'id' => $post->id]); ?> "><?php echo $post->title; ?> </a> </li> <li class="list-group-item"> Author: <?php echo $author; ?> </li>