本文整理汇总了PHP中app\models\News::getCatOption方法的典型用法代码示例。如果您正苦于以下问题:PHP News::getCatOption方法的具体用法?PHP News::getCatOption怎么用?PHP News::getCatOption使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类app\models\News
的用法示例。
在下文中一共展示了News::getCatOption方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1:
<div class="news-form">
<?php
$form = ActiveForm::begin();
?>
<?php
echo $form->field($model, 'title')->textInput(['maxlength' => true]);
?>
<!--
<//?= $form->field($model, 'cat')->textInput() ?>
-->
<?php
echo $form->field($model, 'cat')->dropDownList(News::getCatOption());
?>
<!--
<//?= $form->field($model, 'content')->textarea(['rows' => 6]) ?>
-->
<?php
echo $form->field($model, 'content')->widget(Widget::className(), ['settings' => ['lang' => 'zh_cn', 'minHeight' => 200, 'maxHeight' => 400, 'buttonSource' => true, 'convertDivs' => false, 'removeEmptyTags' => false, 'plugins' => ['clips', 'fullscreen', 'fontcolor', 'fontfamily', 'fontsize', 'limiter', 'table', 'textexpander', 'textdirection', 'video', 'definedlinks', 'filemanager', 'imagemanager'], 'imageManagerJson' => Url::to(['/news/imagesget']), 'imageUpload' => Url::to(['/news/imageupload'])]]);
?>
<!--
<//?= $form->field($model, 'create_time')->textInput() ?>
示例2: function
use app\models\News;
/* @var $this yii\web\View */
/* @var $searchModel app\models\NewsSearch */
/* @var $dataProvider yii\data\ActiveDataProvider */
$this->title = '新闻管理';
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="news-index">
<h4><?php
echo Html::encode($this->title);
?>
</h4>
<?php
// echo $this->render('_search', ['model' => $searchModel]);
?>
<p>
<?php
echo Html::a('创建新闻', ['create'], ['class' => 'btn btn-success']);
?>
</p>
<?php
echo GridView::widget(['dataProvider' => $dataProvider, 'filterModel' => $searchModel, 'showOnEmpty' => false, 'tableOptions' => ['class' => 'table table-striped'], 'columns' => ['news_id', 'title', 'create_time', ['attribute' => 'cat', 'label' => '分类', 'value' => function ($model, $key, $index, $column) {
return News::getCatOption($model->cat);
}, 'filter' => News::getCatOption(), 'headerOptions' => array('style' => 'width:90px;')], 'clickcnt', ['class' => 'yii\\grid\\ActionColumn']]]);
?>
</div>