public function run()
 {
     $this->registerClientAssets();
     $query = new TaggingQuery();
     $this->tags = $query->select('tags')->from('{{%posts}}')->getTags();
     return $this->render('tag_cloud_widget', ['widget' => $this]);
 }
Beispiel #2
0
 public function run()
 {
     $query = new TaggingQuery();
     $tags = $query->select('tags')->from(Article::tableName())->delimiter(', ')->getTags();
     if (empty($tags)) {
         return false;
     }
     return $this->render('default', ['tags' => $tags]);
 }
Beispiel #3
0
 public function actionPosts()
 {
     $query = new Query();
     $query->select('e.id, title, content, e.created_at, u.username, u.avatar')->from('{{%home_post}} as e')->join('LEFT JOIN', '{{%user}} as u', 'u.id=e.user_id')->where('e.explore_status=1')->orderBy('e.id DESC');
     //按标签查询出文章
     if (Yii::$app->request->isGet) {
         $tag = Yii::$app->request->get('tag');
         $query->where('tags LIKE :tag', [':tag' => '%' . $tag . '%'])->andWhere('explore_status=1');
     }
     $posts = Yii::$app->tools->Pagination($query, 10);
     //标签列表
     $query = new TaggingQuery();
     $tags = $query->select('tags')->from('{{%home_post}}')->where('explore_status=1')->limit(10)->displaySort(['freq' => SORT_DESC])->getTags();
     return $this->render('posts', ['posts' => $posts, 'tags' => $tags]);
 }
Beispiel #4
0
 public function actionIndex()
 {
     $query = new Query();
     $query = $query->select('*')->from('{{%home_post}}')->where('user_id=:user_id', [':user_id' => Yii::$app->user->id])->orderBy('created_at DESC');
     //按标签查询出文章
     if (Yii::$app->request->isGet) {
         $tag = Yii::$app->request->get('tag');
         $query->andWhere('tags LIKE :tag', [':tag' => '%' . $tag . '%']);
     }
     $posts = Yii::$app->tools->Pagination($query);
     //标签列表
     $query = new TaggingQuery();
     $tags = $query->select('tags')->from('{{%home_post}}')->where('user_id=:user_id', [':user_id' => Yii::$app->user->id])->displaySort(['freq' => SORT_DESC])->getTags();
     return $this->render('index', ['tags' => $tags, 'posts' => $posts['result'], 'pages' => $posts['pages']]);
 }