本文整理汇总了PHP中kartik\helpers\Html::encode方法的典型用法代码示例。如果您正苦于以下问题:PHP Html::encode方法的具体用法?PHP Html::encode怎么用?PHP Html::encode使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类kartik\helpers\Html
的用法示例。
在下文中一共展示了Html::encode方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: renderDataCellContent
/**
* @inheritdoc
*/
protected function renderDataCellContent($model, $key, $index)
{
$value = $this->getDataCellValue($model, $key, $index);
$name = $this->getLabelName($model, $key, $index, $value);
$class = ArrayHelper::getValue($this->cssCLasses, $value, 'default');
$html = Html::tag('span', Html::encode($name), ['class' => 'label label-' . $class]);
return $value === null ? $this->grid->emptyCell : $html;
}
示例2: renderDataCellContent
protected function renderDataCellContent($model, $key, $index)
{
$value = $this->getDataCellValue($model, $key, $index);
$label = $value ? $this->getRoleLabel($value) : $value;
$class = $value == $this->defaultRole ? 'primary' : 'danger';
$html = Html::tag('span', Html::encode($label), ['class' => 'label label-' . $class]);
return $value === null ? $this->grid->emptyCell : $html;
}
示例3: function
echo $form->field($model, 'file')->fileInput();
?>
</div>
</div>
<div class="form-group row">
<div class="col-md-12">
<fieldset>
<legend>
<?php
echo Yii::t('app', 'Add property groups to each new object: ');
?>
</legend>
<?php
echo $form->field($model, 'addPropertyGroups')->checkboxList(\yii\helpers\ArrayHelper::map(\app\models\PropertyGroup::getForObjectId($object->id), 'id', 'name'), ['item' => function ($index, $label, $name, $checked, $value) {
$line = Html::beginTag('div', ['class' => 'checkbox']);
$line .= Html::checkbox($name, $checked, ['value' => $value, 'label' => Html::encode($label)]);
$line .= '</div>';
return $line;
}])->label('');
?>
</fieldset>
</div>
</div>
<?php
}
?>
<?php
if (!$importMode) {
?>
<?php
示例4:
<?php
echo Html::encode($this->title);
?>
<br />
<small>
<?php
echo Html::a($model->votes_up, ['voteup', 'id' => $model->id, 'redirect' => 'view?id=' . $model->id], ['class' => 'like glyphicon glyphicon-thumbs-up nounderline', 'data' => ['toggle' => 'tooltip', 'placement' => 'right'], 'title' => 'Vote me Up']);
?>
<?php
echo Html::a($model->votes_down, ['votedown', 'id' => $model->id, 'redirect' => 'view?id=' . $model->id], ['class' => 'unlike glyphicon glyphicon-thumbs-down nounderline', 'data' => ['toggle' => 'tooltip', 'placement' => 'right'], 'title' => 'Vote me Down']);
?>
</small>
</h1>
<h3 class="col-md-8 text-center">
<?php
echo Html::encode($model->description);
?>
</h3>
<h1 class="col-md-1">
<small>
<?php
if ($model->api0->name !== 'core') {
?>
<?php
echo Html::a(Html::icon('pencil', ['data' => ['toggle' => 'tooltip', 'placement' => 'right'], 'title' => 'Update']), ['update', 'id' => $model->id], ['class' => 'btn btn-primary']);
?>
<?php
echo Html::a(Html::icon('trash', ['data' => ['toggle' => 'tooltip', 'placement' => 'right'], 'title' => 'Delete']), ['delete', 'id' => $model->id], ['class' => 'btn btn-danger', 'data' => ['confirm' => 'Are you sure you want to delete this item?', 'method' => 'post']]);
?>
<?php
}
示例5:
<?php
ActiveForm::end();
?>
<section style="display: none" data-type="x-tmpl-underscore" id="parameter-template">
<div class="row form-group parameter">
<label class="col-md-2 control-label" for="PropertyValue_<%- index %>">
<select class="property_id form-control">
<option value="0">- <?php
echo Yii::t('app', 'select');
?>
-</option>
<?php
foreach ($static_values_properties as $prop) {
echo "<option value=\"" . $prop['property']->id . "\">" . Html::encode($prop['property']->name) . "</option>";
}
?>
</select>
</label>
<div class="col-md-10">
<div class="input-group">
<select id="PropertyValue_<%- index %>" class="form-control select">
</select>
<span class="input-group-btn">
<a class="btn btn-danger btn-remove">
<?php
echo Icon::show('thrash-o');
?>
<?php
echo Yii::t('app', 'Remove');
示例6:
</div>
<div class="form-group field-page-name">
<p class="control-label col-md-2" ><?php
echo Yii::t('app', 'Form');
?>
</p>
<div class="col-md-10">
<?php
$form = Form::findById($review->submission->form_id);
?>
<?php
if (null !== $form) {
?>
<?php
echo Html::encode($form->name);
?>
<?php
}
?>
</div>
<div class="col-md-offset-2 col-md-10"></div>
</div>
<div class="form-group field-page-name">
<p class="control-label col-md-2" ><?php
echo Yii::t('app', 'IP');
?>
</p>
<div class="col-md-10">
<?php
示例7: function
use yii\widgets\Pjax;
use app\modules\page\models\backend\Page;
use app\widgets\grid\SetColumn;
/* @var $this yii\web\View */
/* @var $searchModel app\modules\page\models\backend\search\PageSearch */
/* @var $dataProvider yii\data\ActiveDataProvider */
$this->title = 'Страницы';
$this->params['breadcrumbs'][] = $this->title;
?>
<h1><?php
echo Html::encode($this->title);
?>
</h1>
<p class="pull-left">
<?php
echo Html::a('<i class="material-icons">add</i> Добавить страницу', ['create'], ['class' => 'btn btn-success']);
?>
</p>
<?php
Pjax::begin(['enablePushState' => false]);
echo GridView::widget(['dataProvider' => $dataProvider, 'filterModel' => $searchModel, 'columns' => [['class' => 'yii\\grid\\CheckboxColumn', 'contentOptions' => ['class' => 'check-column']], ['attribute' => 'title', 'format' => 'raw', 'value' => function ($model, $key, $index, $column) {
/** @var \app\modules\page\models\backend\Page $model */
return Html::a(Html::encode($model->title), ['/page/node/view', 'slug' => $model->slug]);
}], ['attribute' => 'updated_at', 'format' => 'datetime', 'contentOptions' => ['class' => 'at-column']], ['class' => SetColumn::className(), 'filter' => Page::getStatusesArray(), 'attribute' => 'status', 'name' => 'statusName', 'cssCLasses' => [Page::STATUS_ACTIVE => 'success', Page::STATUS_WAIT => 'warning'], 'contentOptions' => ['class' => 'status-column']], ['class' => 'app\\widgets\\grid\\ActionColumn', 'buttons' => ['view' => function ($url, $model, $key) {
/** @var \app\modules\page\models\backend\Page $model */
return Html::a('<i class="material-icons">visibility</i>', ['/page/node/view', 'slug' => $model->slug]);
}]]]]);
Pjax::end();
示例8:
<?php
use kartik\helpers\Html;
use app\modules\admin\rbac\Rbac as AdminRbac;
/* @var $this yii\web\View */
/* @var $model app\modules\slider\models\backend\Slider */
?>
<?php
$this->beginBlock('title');
echo Yii::$app->user->can(AdminRbac::PERMISSION_ADMIN_PANEL) ? Html::a('<i class="material-icons">mode_edit</i>', ['/admin/sliders/default/update', 'id' => $model->id]) : false;
echo Html::encode($model->title);
$this->endBlock();
?>
<div class="container">
<div class="field-body">
<?php
echo $model->body;
?>
</div>
</div>
示例9:
* @var \app\modules\shop\models\OrderItem[] $items
* @var \yii\web\View $this
*/
use app\modules\shop\models\Product;
use kartik\helpers\Html;
foreach ($items as $item) {
?>
<tr class="warning" style="color: #666; font-size: 12px;">
<td style="padding-left: 40px;">
<?php
echo \app\modules\image\widgets\ObjectImageWidget::widget(['limit' => 1, 'model' => $item->product]);
?>
</td>
<td>
<?php
echo Html::encode($item->product->name);
?>
</td>
<td><?php
echo $item->product->formattedPrice(null, false, false);
?>
</td>
<td>
<?php
if ($immutable === true) {
?>
<?php
echo $item->quantity;
?>
<?php
} else {
示例10:
if (count($model->images) > 1) {
?>
<div class="other-images">
<?php
echo ObjectImageWidget::widget(['model' => $model]);
?>
</div>
<?php
}
?>
</div>
</div>
<div class="col-md-6 col-sm-6 col-xs-12 col-lg-8">
<h1 itemprop="name">
<?php
echo Html::encode($model->h1);
?>
</h1>
<div class="row">
<div class="col-md-6 col-sm-6 col-xs-12 col-lg-8">
<div itemprop="description">
<?php
if (empty($this->blocks['announce'])) {
$propertiesShowedInAnnounce = true;
echo \app\properties\PropertiesWidget::widget(['model' => $model, 'viewFile' => 'show-properties-widget']);
} else {
echo $this->blocks['announce'];
}
?>
</div>
示例11: function
<?php
use kartik\helpers\Html;
use yii\widgets\ListView;
use yii\widgets\Pjax;
/* @var $this yii\web\View */
/* @var $dataProvider yii\data\ActiveDataProvider */
$this->title = 'Галерея';
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="gallery-index">
<h1><?php
echo Html::encode($this->title);
?>
</h1>
<?php
Pjax::begin();
?>
<div class="gallery-view-block">
<?php
echo ListView::widget(['dataProvider' => $dataProvider, 'itemOptions' => ['class' => 'item'], 'layout' => '{items}{pager}', 'itemView' => function ($model, $key, $index, $widget) {
return Html::a(Html::tag('div', Html::icon('folder-open')) . Html::tag('div', Html::encode($model->name), ['class' => 'gallery-view-box-name']), ['view', 'id' => $model->id], ['class' => 'gallery-view-box text-center']);
}]);
?>
</div>
<?php
Pjax::end();
?>
</div>
示例12: function
<?php
use yii\widgets\Pjax;
use kartik\helpers\Html;
use yii\helpers\ArrayHelper;
Pjax::begin(['id' => 'answer-poll', 'timeout' => 5000]);
if (empty($answerPoll)) {
if (isset($alertMessage) && $alertMessage != '') {
echo $alertMessage;
}
echo Html::beginForm(['/'], 'post', ['data-pjax' => '1', 'class' => '']);
echo Html::radioList('answer_id', $answersData[0]->id, ArrayHelper::map($answersData, 'id', 'answer'), ['item' => function ($index, $label, $name, $checked, $value) {
return Html::tag('div', Html::radio($name, $checked, ['value' => $value, 'label' => Html::encode($label)]), ['class' => 'radio']);
}]);
echo Html::input('hidden', 'question_id', $questions['id']);
echo Html::submitButton('Голосовать', ['class' => 'btn btn-sm btn-primary', 'name' => 'hash-button']);
echo Html::endForm();
} else {
$sumOfVoices = 0;
foreach ($answersData as $item) {
$sumOfVoices = $sumOfVoices + $item->how_many;
}
for ($i = 0; $i < count($answersData); $i++) {
$voicesPer = 0;
if ($sumOfVoices == 0) {
$voicesPer = 0;
} else {
$voicesPer = round($answersData[$i]->how_many / $sumOfVoices, 4) * 100;
}
?>
<div class="poll-option-block">
示例13:
乐宝 = 1
永利会 = 2
落地
<script type="text/javascript" src="//tj.sasa8.com/ld.js"></script>
推广
<script type="text/javascript" src="//tj.sasa8.com/tg.js"></script>
注册
<script type="text/javascript" src="//tj.sasa8.com/zc.js"></script>
CODE;
?>
<?php
echo \kartik\helpers\Html::encode($str);
?>
</pre>
</td>
</tr>
</table>
</div>
</div>
示例14:
<?php
/**
* @var $attribute_name string
* @var $form \yii\widgets\ActiveForm
* @var $label string
* @var $model \app\properties\AbstractModel
* @var $multiple boolean
* @var $property_id integer
* @var $property_key string
* @var $this \app\properties\handlers\Handler
* @var $values array
*/
use app\models\Property;
use kartik\helpers\Html;
?>
<dl>
<?php
if (count($values->values) == 0) {
return;
}
$property = Property::findById($property_id);
echo Html::tag('dt', $property->name);
foreach ($values->values as $val) {
if (isset($val['value'])) {
echo Html::tag('dd', Html::encode($val['value']));
}
}
?>
</dl>
示例15:
</th>
</tr>
</thead>
<tbody>
<?php
foreach ($items as $item) {
?>
<tr>
<td class="product-image">
<?php
echo \app\modules\image\widgets\ObjectImageWidget::widget(['limit' => 1, 'model' => $item->product, 'thumbnailOnDemand' => true, 'thumbnailWidth' => 140, 'thumbnailHeight' => 140]);
?>
</td>
<td>
<?php
echo Html::a(Html::encode($item->product->name), \yii\helpers\Url::to(['/shop/product/show', 'model' => $item->product, 'category_group_id' => $item->product->category->category_group_id]));
?>
</td>
<td>
<?php
echo $mainCurrency->format($item->price_per_pcs);
?>
</td>
<td><?php
echo $item->quantity;
?>
</td>
<td>
<span class="item-price">
<?php
if ($item->discount_amount > 0) {