protected function renderContent() { $tags = Tag::findTagWeights($this->maxTags); // $tags = ['test'=>14, 'sss'=>20]; echo Html::begintag('ul', array('class' => 'list-inline')); foreach ($tags as $tag => $weight) { $link = Html::a(Html::encode($tag), array('post/index', 'tags' => $tag)) . "\n"; echo Html::tag('li', $link, array('style' => "font-size:{$weight}px;margin:2px")) . "\n"; } echo Html::endTag('ul'); }
public function actionDetail($id) { $postModel = new Comment(); if ($postModel->load(Yii::$app->request->post())) { $postModel->status = Comment::STATUS_INACTIVE; $postModel->post_id = $id; if ($postModel->save()) { $this->added = 1; } } $tags = Tag::findTagWeights(); $cateModel = new Cate(); $cateDataProvider = $cateModel->getCates(); $postData = new Post(); $postDataProvider = $postData->findRecentPosts(); $commentModel = new Comment(); $commentDataProvider = $commentModel->findRecentComments(); return $this->render('detail', ['tags' => $tags, 'added' => $this->added, 'postModel' => $postModel, 'model' => $this->findModel($id), 'postDataProvider' => $postDataProvider, 'cateDataProvider' => $cateDataProvider, 'commentDataProvider' => $commentDataProvider]); }