<p> <?php if (PostComment::getCountComments($model->id) > 0) { ?> <span class="glyphicon glyphicon-comment"></span> <a href="<?php echo Url::to(['default/view', 'id' => $model->id, '#' => 'comments']); ?> "><?php echo Module::t('module', 'COMMENTS:{count}', ['count' => PostComment::getCountComments($model->id)]); ?> </a> | <?php } ?> <?php if ($model->tagLinks) { ?> <span class="glyphicon glyphicon-tags"></span> <?php echo Tags::array2string($model->tagLinks); ?> <?php } ?> </p> <?php echo Html::a(Module::t('module', 'READ_MORE') . ' <span class="glyphicon glyphicon-chevron-right"></span>', ['default/view', 'id' => $model->id], ['class' => 'btn btn-primary']); ?> <hr>
public function getTags() { $model = new Tags(); return $model->findTagWeights($this->maxTags); }
<span class="glyphicon glyphicon-th-large"></span> <?php echo $post->category->title; ?> </p> <hr> <p><?php echo Markdown::convert($post->content); ?> </p> <?php if ($post->tagLinks) { ?> <hr> <p><span class="glyphicon glyphicon-tags"></span> <?php echo Tags::array2string($post->tagLinks); ?> </p> <?php } ?> <hr> <!-- Blog Comments --> <?php echo CommentsWidget::widget(['title' => Module::t('module', 'TITLE_COMMENTS'), 'material' => $post, 'model' => $modelComments, 'imgUser' => AvatarWidget::widget()]); ?> </div> <!-- Blog Sidebar Widgets Column --> <div class="col-md-4">
/** * Возвращает опубликованые посты по тегу с пагинацией * @param $tag * @return array */ public function getPublishedPostsTags($tag) { $query = Tags::findOne(['title' => $tag]); $countQuery = count($query->postsTag); $pages = new Pagination(['totalCount' => $countQuery, 'defaultPageSize' => \Yii::$app->getModule('blog')->pageSize]); $posts = $query->getPostsTag($pages->offset, $pages->limit)->all(); return ['posts' => $posts, 'pages' => $pages]; }
public function init() { parent::init(); }
/** * @return \yii\db\ActiveQuery */ public function getTag() { return $this->hasOne(Tags::className(), ['id' => 'tag_id']); }