本文整理汇总了PHP中app\models\Tag::findTagWeights方法的典型用法代码示例。如果您正苦于以下问题:PHP Tag::findTagWeights方法的具体用法?PHP Tag::findTagWeights怎么用?PHP Tag::findTagWeights使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类app\models\Tag
的用法示例。
在下文中一共展示了Tag::findTagWeights方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: init
public function init()
{
parent::init();
$tag = new Tag();
$tags = $tag->findTagWeights($this->max);
foreach ($tags as $tag => $weight) {
$link = Html::a(Html::encode($tag), ['post/index', 'tag' => $tag]);
echo Html::tag('span', $link, ['class' => 'tag', 'style' => "font-size:{$weight}pt"]) . "\n";
}
}
示例2: actionDetail
/**
* Displays a post detail.
* @param integer $id
* @return mixed
*/
public function actionDetail($id)
{
$postModel = new Comment();
if ($postModel->load(Yii::$app->request->post())) {
$postModel->status = Comment::STATUS_PENDING;
$postModel->post_id = $id;
if ($postModel->save()) {
$this->added = 1;
}
}
$tags = Tag::findTagWeights(Yii::$app->params['tagCloudCount']);
$commentModel = new Comment();
$commentDataProvider = $commentModel->findRecentComments(Yii::$app->params['recentCommentCount']);
//Yii::$app->params['recentCommentCount']
return $this->render('detail', ['model' => $this->findModel($id), 'commentDataProvider' => $commentDataProvider, 'tags' => $tags, 'postModel' => $postModel, 'added' => $this->added]);
}
示例3: isset
/**
* @var \yii\web\View $this
* @var \yii\gii\Generator[] $generators
* @var \yii\gii\Generator $activeGenerator
* @var string $content
*/
//$activeGenerator = Yii::$app->controller->generator;
$activeGenerator = isset($_GET['id']) ? $_GET['id'] : '1';
/***分类总数****/
$category = Yii::$app->controller->category();
/**分类名称获取 继承自BaseModel**/
$humourClassify = Humour::humourClassify();
/*热门文章*/
$hotPosts = Humour::getHotPosts();
/*热门标签*/
$tags = Tag::findTagWeights(20, 'humour');
$this->beginContent('@app/views/layouts/main.php');
//$this->beginContent('@app/views/layouts/main.php');
?>
<style type="text/css">
.list-group .glyphicon {
float: right;
}
</style>
<div class="row">
<div class="col-md-9 col-sm-8">
<?php
echo $content;
?>
</div>
示例4: array
<?php
use yii\helpers\Html;
use yii\helpers\Url;
use app\models\Tag;
?>
<div class="panel panel-default">
<div class="panel-heading">Tags</div>
<div class="panel-body">
<?php
foreach (Tag::findTagWeights() as $tag => $weight) {
$link = Url::toRoute(['book/index', 'tag' => $tag]);
echo Html::tag('a', $tag, array('style' => "font-size:{$weight}pt", 'href' => $link)) . "\n";
}
?>
</div>
</div>
示例5: isset
/**
* @var \yii\web\View $this
* @var \yii\gii\Generator[] $generators
* @var \yii\gii\Generator $activeGenerator
* @var string $content
*/
//$activeGenerator = Yii::$app->controller->generator;
$activeGenerator = isset($_GET['id']) ? $_GET['id'] : '1';
/***分类总数****/
$category = Yii::$app->controller->category();
/**分类名称获取 继承自BaseModel**/
$topicClassify = TopicAdmin::topicClassify();
/*热门文章*/
$hotPosts = TopicAdmin::getHotPosts();
/*热门标签*/
$tags = Tag::findTagWeights(20, 'topic');
$this->beginContent('@app/views/layouts/main.php');
//$this->beginContent('@app/views/layouts/main.php');
?>
<style type="text/css">
.list-group .glyphicon {
float: right;
}
</style>
<div class="row">
<div class="col-md-9 col-sm-8">
<?php
echo $content;
?>
</div>
示例6: isset
/**
* @var \yii\web\View $this
* @var \yii\gii\Generator[] $generators
* @var \yii\gii\Generator $activeGenerator
* @var string $content
*/
//$activeGenerator = Yii::$app->controller->generator;
$activeGenerator = isset($_GET['id']) ? $_GET['id'] : '1';
/***分类总数****/
$category = Yii::$app->controller->category();
/**分类名称获取 继承自BaseModel**/
$musicClassify = Music::musicClassify();
/*热门文章*/
$hotPosts = Music::getHotPosts();
/*热门标签*/
$tags = Tag::findTagWeights(20, 'music');
$this->beginContent('@app/views/layouts/main.php');
//$this->beginContent('@app/views/layouts/main.php');
?>
<style type="text/css">
.list-group .glyphicon {
float: right;
}
</style>
<div class="row">
<div class="col-md-9 col-sm-8">
<?php
echo $content;
?>
</div>