public function actionView($userid = 0, $catid = 0, $viewid) { $category = []; $read = BlogRecords::findOne(['id' => $viewid]); if ($catid != 0) { $category = BlogCategories::findOne(['id' => $catid]); } return $this->render('view', ['record' => $read, 'userid' => $userid, 'category' => $category]); }
?> </div> <div class="col-lg-4"> <aside class="right-sidebar"> <div class="widget"> <form class="form-search"> <input class="form-control" type="text" placeholder="Search.."> </form> </div> <div class="widget"> <h5 class="widgetheading"><?php echo Yii::t('app', 'Categories'); ?> </h5> <?php $tree = \app\models\BlogCategories::getCategoriesTree(); echo $this->render('/blog/categories_list', ['tree' => $tree]); ?> </div> <div class="widget"> <h5 class="widgetheading">Latest posts</h5> <ul class="recent"> <li> <img src="/img/dummies/blog/65x65/thumb1.jpg" class="pull-left" alt="" /> <h6><a href="#">Lorem ipsum dolor sit</a></h6> <p> Mazim alienum appellantur eu cu ullum officiis pro pri </p> </li> <li> <a href="#"><img src="/img/dummies/blog/65x65/thumb2.jpg" class="pull-left" alt="" /></a>
public function getCategories() { return $this->hasOne(BlogCategories::className(), ['id' => 'category_id']); }