本文整理汇总了PHP中yii\helpers\Html::Tag方法的典型用法代码示例。如果您正苦于以下问题:PHP Html::Tag方法的具体用法?PHP Html::Tag怎么用?PHP Html::Tag使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类yii\helpers\Html
的用法示例。
在下文中一共展示了Html::Tag方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1:
<h4><?php
echo $model->name;
?>
</h4>
<hr style="margin:20px 0px 20px;">
<?php
echo Html::beginTag('div', ['style' => 'margin-bottom:15px;']);
foreach ($model->children()->all() as $catalog) {
echo Html::Tag('span', Html::a($catalog->name . " (" . $catalog->getProducts()->count() . ")", ['catalogs/view', 'catalog_id' => $catalog->catalog_id], ['style' => 'margin-right:30px;']), ['style' => 'display:inline-block;']);
}
echo Html::endTag('div');
?>
<?php
if ($model->children()->count() > 0) {
echo Html::Tag('hr', null, ['style' => 'margin:20px 0px 20px;']);
}
?>
<?
if ( $searchModel->price_min == 0) {
$price_min_val = 0;
}
else {
$price_min_val = $searchModel->price_min;
}
if ( $searchModel->price_max == 0) {
示例2: run
public function run()
{
$this->options['alt'] = $this->alt;
$this->options['icon'] = $this->icon;
$this->options['src'] = $this->src;
return Html::Tag($this->tagName, '', $this->options);
}
示例3:
use yii\widgets\LinkPager;
?>
<div class="col-xs-12 col-sm-12 col-md-12 col-lg-12 panel-basic panel-basic-default">
<h4><?php
echo $model->name;
?>
</h4>
<hr style="margin:20px 0px 20px;">
<?php
echo Html::beginTag('div', ['style' => 'margin-bottom:15px;']);
foreach ($model->children()->all() as $catalog) {
echo Html::Tag('span', Html::a($catalog->name . " (" . $catalog->getProducts()->count() . ")", ['catalogs/view', 'catalog_id' => $catalog->catalog_id], ['style' => 'margin-right:30px;']), ['style' => 'display:inline-block;']);
}
echo Html::endTag('div');
echo $this->render('_search', ['model' => $searchModel, 'catalog' => $model, 'price_min' => $price_min, 'price_max' => $price_max, 'price_min_val' => $price_min_val, 'price_max_val' => $price_max_val]);
?>
</div>
<div class="col-xs-12 col-sm-12 col-md-12 col-lg-12 panel-basic panel-basic-default" style="padding:20px;">
示例4: function
<?php
use yii\helpers\Html;
use yii\widgets\ListView;
?>
<div class="col-xs-12 col-sm-12 col-md-12 col-lg-12">
<?php
// по умолчанию выводим списком
echo Html::Tag('div', ListView::widget(['dataProvider' => $dataProvider, 'layout' => "{items}", 'emptyText' => 'Ничего не найдено', 'emptyTextOptions' => ['class' => 'row'], 'itemView' => '/site/popular/row', 'itemView' => function ($model, $key, $index, $widget) {
return $this->render('/site/popular/listView', ['model' => $model]);
}]), []);
?>
</div>
示例5: function
// [ 'products/view', 'product_id' => $model->product_id ], [ 'style' => 'display:block;' ]);
}], ['class' => 'yii\\grid\\DataColumn', 'label' => '', 'headerOptions' => ['style' => 'border-left:none;border-top:1px solid #ddd;'], 'footerOptions' => ['class' => 'text-right', 'style' => 'border-bottom:1px solid #ddd;'], 'format' => 'raw', 'value' => function ($model) {
return Html::a($model->name, ['products/view', 'product_id' => $model->product_id], ['style' => 'display:block;']);
}], ['class' => 'yii\\grid\\DataColumn', 'label' => 'Цена', 'format' => 'html', 'headerOptions' => ['style' => 'border-top:1px solid #ddd;border-right:0;'], 'contentOptions' => ['style' => 'border-right:0;'], 'footer' => '<span style="font-size: 22px;">Итого</span>', 'footerOptions' => ['class' => 'text-right', 'style' => 'border-right:none;border-bottom:1px solid #ddd;'], 'value' => function ($model) {
return '<span style="font-size: 16px;">' . number_format($model->price, 0, '.', ' ') . '</span>';
}], ['class' => 'yii\\grid\\DataColumn', 'label' => '', 'format' => 'html', 'headerOptions' => ['style' => 'border-top:1px solid #ddd;border-left:0;'], 'contentOptions' => ['style' => 'border-left:0;padding-top: 10px;'], 'footerOptions' => ['style' => 'border-left:none;border-bottom:1px solid #ddd;'], 'value' => function ($model) {
return '<i class="glyphicon-cart glyphicon-ruble" style="margin-left:20px;font-size: 14px;"></i>';
}], ['class' => 'yii\\grid\\DataColumn', 'label' => 'Количество', 'headerOptions' => ['style' => 'border-top:1px solid #ddd;'], 'contentOptions' => ['style' => 'max-width:100px!important;'], 'footer' => '<span id="cart_quantity" style="font-size: 22px;">' . Yii::$app->cart->getCount() . '</span>', 'footerOptions' => ['style' => 'border-bottom:1px solid #ddd;'], 'format' => 'raw', 'value' => function ($model) {
// return Yii::$app->cart->getPositionById($model->id)->getQuantity();
return TouchSpin::widget(['name' => 'count', 'pluginOptions' => ['verticalbuttons' => true, 'min' => 1, 'initval' => Yii::$app->cart->getPositionById($model->product_id)->getQuantity(), 'verticalupclass' => 'glyphicon glyphicon-plus', 'verticaldownclass' => 'glyphicon glyphicon-minus', 'buttonup_txt' => '<i class="glyphicon glyphicon glyphicon-plus"></i>', 'buttondown_txt' => '<i class="glyphicon glyphicon glyphicon-minus"></i>'], 'pluginEvents' => ['change' => "function() { \n\n\t\t\t\t\t\t\t// if (this.value>100) {\n\t\t\t\t\t\t\t// \t//не больше 100 штук\n\t\t\t\t\t\t\t// \tthis.value = 100;\n\t\t\t\t\t\t\t// }\n\t\t\t\t\t\t\tjQuery.ajax(\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t'type':'POST',\n\t\t\t\t\t\t\t'data':{'product_id':\"{$model->product_id};\",'quantity':this.value},\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t'dataType':'json',\n\t\t\t\t\t\t\t'success':function(data){\n\t\t\t\t\t\t\t\$('.cart_cost').html(data.cart_cost);\n\t\t\t\t\t\t\t\$('.cartContent').html(data.cartContent);\n\t\t\t\t\t\t\t\$('#cart_quantity').html(data.cart_quantity);\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\$('#position_cost_{$model->product_id}').html(data.position_cost);\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t'url':'/cart/change-quantity/',\n\t\t\t\t\t\t\t'cache':false\n\t\t\t\t\t\t\t});\n\n\t\t\t\t \t }"]]);
}], ['class' => 'yii\\grid\\DataColumn', 'label' => 'Сумма', 'format' => 'raw', 'headerOptions' => ['style' => 'border-top:1px solid #ddd;border-right:0;'], 'contentOptions' => ['style' => 'border-right:0;'], 'footer' => '<span class="cart_cost"style="color:#d2322d;font-size: 22px;">' . number_format(Yii::$app->cart->getCost(), 0, '.', ' ') . '</span>', 'footerOptions' => ['style' => 'border-right:0; border-bottom:1px solid #ddd;min-width:100px!important;'], 'value' => function ($model) {
return '<span id="position_cost_' . $model->product_id . '" style="color:#d2322d;font-size: 22px;">' . number_format(Yii::$app->cart->getPositionById($model->product_id)->getCost(), 0, '.', ' ') . '</span>';
return;
}], ['class' => 'yii\\grid\\DataColumn', 'label' => ' ', 'format' => 'html', 'headerOptions' => ['style' => 'border-top:1px solid #ddd;border-left:0;'], 'contentOptions' => ['style' => 'border-left:0;padding-top: 12px;'], 'footer' => '<i class="glyphicon-cart glyphicon-ruble" style="margin-left:20px;color:#d2322d;font-size: 20px;"></i></span>', 'footerOptions' => ['style' => 'border-left:0;border-bottom:1px solid #ddd;padding-top: 12px;'], 'value' => function ($model) {
return '<i id="clear" class="glyphicon-cart glyphicon-ruble" style="margin-left:20px;color:#d2322d;font-size: 20px;"></i>';
}], ['class' => '\\yii\\grid\\ActionColumn', 'header' => Html::a(Html::Tag('i', null, ['class' => 'glyphicon-cart glyphicon-remove cart-remove']), ['#'], ['id' => 'clear', 'style' => 'text-decoration:none;']), 'headerOptions' => ['style' => 'border-top:1px solid #ddd;border-right:none;'], 'contentOptions' => ['style' => 'border-right:none;'], 'footerOptions' => ['style' => 'border-right:none;'], 'template' => '{delete}', 'buttons' => ['delete' => function ($url, $model) {
$url = Url::toRoute('/cart/remove/');
$jsCartRemove = <<<JS
\t\t\t\$("#remove_{$model->product_id}").on('click',
\t\t\t\tfunction() {
\t\t\t\t\t\$.ajax({
\t\t\t\t\ttype :'POST',
\t\t\t\t\tdataType :'json',
\t\t\t\t\tcache : false,
\t\t\t\t\tasync : false,
\t\t\t\t\turl : '{$url}',
\t\t\t\t\tdata: {id: {$model->product_id}},
示例6:
echo Html::beginTag('div', ['class' => 'panel-basic panel-basic-default panel-border', 'style' => 'height:326px;']);
// panel heading
echo Html::beginTag('div', ['class' => 'panel-heading', 'style' => 'height:80px;background-color:#fff;border:none;']);
echo Html::Tag('p', Html::a($model->name, ['products/view', 'product_id' => $model->id], ['style' => 'display:block;']), ['class' => 'text-center']);
echo HTML::endTag('div');
// panel heading
// panel body
echo Html::beginTag('div', ['class' => 'panel-body', 'style' => 'height:187px;text-align:center;']);
$mainPhoto = $model->MainPhoto;
echo Html::a(Html::img($mainPhoto->getUrl('original'), ['class' => 'img-responsive', 'style' => 'display: -moz-inline-box; display: inline-block; vertical-align: middle; height:100%; zoom: 1;']), ['products/view', 'product_id' => $model->product_id]);
echo HTML::endTag('div');
// panel body
// panel footer
echo Html::beginTag('div', ['class' => 'col-xs-12 col-sm-12 col-md-12 col-lg-12']);
echo Html::beginTag('div', ['class' => 'panel-footer', 'style' => 'background-color:#fff;']);
echo Html::Tag('span', number_format($model->price, 0, '.', ' ') . '<i class="glyphicon glyphicon-ruble" style="font-size: 18px;" aria-hidden="true"></i>', ['class' => 'h3', 'style' => 'color:#d2322d;line-height:1.42;']);
echo Html::Button('Купить', ['id' => "put" . $model->id, 'class' => 'btn btn-success pull-right', 'style' => 'border-radius: 0px;']);
echo HTML::endTag('div');
echo HTML::endTag('div');
// panel footer
echo HTML::endTag('div');
?>
<?php
$url = Url::toRoute('/cart/put/');
$jsCartPut = <<<JS
\t\t\t\$("#put{$model->id}").on('click',
\t\t\t\tfunction() {
示例7:
<div class="panel-basic panel-basic-default row">
<div class="panel-basic-heading" style="background-color:#fff;font-weight:bold">Корзина товаров</div>
<?php
if (Yii::$app->session->hasFlash('order')) {
$params = Yii::$app->session->getFlash('order');
echo Html::Tag('p', 'Уважаемый <strong>' . $params['name'] . '</strong>, заказ №<strong>' . $params['id'] . '</strong> успешно оформлен. Копия заказа отправлена вам на почту <strong>' . $params['email'] . '</strong>', ['class' => 'bg-success', 'style' => 'padding:15px;margin:15px;']);
} else {
if (Yii::$app->cart->getCount() > 0) {
echo Html::Tag('div', 'Пожалуйста проверьте ваш заказ перед оформлением.', ['class' => 'panel-basic-body cart-message']);
echo $this->render('_cartTable', ['dataProvider' => $dataProvider]);
} else {
echo Html::Tag('div', 'Ваша корзина пуста', ['class' => 'panel-basic-body cart-message']);
}
}
?>
</div>
</div>
<!-- </div> -->
<div id="cart_order" class="col-xs-12 col-sm-12 col-md-12 col-lg-12 ">
<?php
示例8: renderGrid
/**
* Renders address grid
*/
protected function renderGrid()
{
echo Html::Tag('div', null, ['class' => 'separator bottom']);
echo Html::beginTag('div', ['class' => 'row-fluid']);
echo Html::beginTag('table', ['class' => 'table table-bordered table-striped']);
echo Html::beginTag('thead');
echo Html::beginTag('tr');
echo Html::Tag('th', "CEP");
echo Html::Tag('th', "Endereço");
echo Html::Tag('th', "Bairro");
echo Html::Tag('th', "Cidade");
echo Html::Tag('th', "UF");
echo Html::endTag('tr');
echo Html::endTag('thead');
echo Html::beginTag('tbody');
echo Html::endTag('tbody');
echo Html::endTag('table');
echo Html::endTag('div');
}
示例9: renderControls
/**
* Renders previous and next control buttons.
* @throws InvalidConfigException if [[controls]] is invalid.
*/
public function renderControls($position = 'begin')
{
if ($position === 'begin') {
//<span class="als-prev"><img src="images/thin_left_arrow_333.png" alt="prev" title="previous" /></span>
$icon = Html::tag('i', ' ', array('class' => 'fa fa-arrow-left fa-3', 'title' => 'prev'));
return "<span class='als-prev'>" . $icon . "</span>\n";
} else {
//<span class="als-next"><img src="images/thin_right_arrow_333.png" alt="next" title="next" /></span>
$icon = Html::Tag('i', ' ', array('class' => 'fa fa-arrow-right fa-3', 'title' => 'next'));
return "<span class='als-next'>" . $icon . "</span>\n";
}
}
示例10: programContent
private function programContent()
{
return $this->model->fullContent . Html::Tag('div', $this->linkFiles() . $this->linkStudents() . $this->disciplinesLink(), ['class' => 'program_links']);
}
示例11: foreach
<?php
echo Html::beginTag('ul', ['style' => 'list-style:none;padding-left:0px;']);
foreach ($catalog->children()->all() as $child) {
// echo $product->description;
echo Html::beginTag('li', ['style' => 'margin-bottom: 10px;']);
echo Html::beginTag('div', ['class' => 'row', 'style' => 'margin-left: 0px;margin-right: 0px;']);
echo Html::beginTag('div', ['class' => 'col-xs-2 col-sm-2 col-md-2 col-lg-2', 'style' => 'padding-top:10px; text-align:center;']);
if ($child->getBehavior('coverBehavior')->hasImage()) {
echo Html::a(Html::img($child->getBehavior('coverBehavior')->getUrl('original'), ['class' => 'img-responsive', 'style' => 'display:inline; max-height:80px;']), ['catalogs/view', 'catalog_id' => $child->catalog_id]);
}
echo Html::endTag('div');
echo Html::beginTag('div', ['class' => 'col-xs-10 col-sm-10 col-md-10 col-lg-10']);
echo Html::a($child->name, ['catalogs/view', 'catalog_id' => $child->catalog_id], ['class' => 'maintainHover', 'style' => 'font-size:large;']);
echo Html::Tag('p', $child->description, ['class' => 'text-muted']);
echo Html::endTag('div');
echo Html::endTag('div');
echo Html::endTag('li');
}
echo Html::endTag('ul');
?>
示例12: MakePage
/**
* Соберает и возвращает дерево страниц
* @param array $data
* @return string
*/
public function MakePage(array $data)
{
$this->tag .= Html::beginTag("ul");
foreach ($data as $index => $value) {
$iconPath = yii::getAlias('@assets') . "/images/pages/icons/{$value["type_page"]}/icon";
$submenu = $this->GetActions($value["type_page"], $value["id"]);
$this->tag .= Html::beginTag("li", ["class" => "dropdown"]);
$this->tag .= Html::a($value["name"], "javascript:void(0)", ["data-toggle" => "dropdown", "style" => "background:url(" . app::I()->GetImageFromDir($iconPath) . ") no-repeat left center"]);
$this->tag .= Html::beginTag("ul", ["class" => "dropdown-menu", "role" => "menu"]);
if (!empty($submenu)) {
foreach ($submenu as $i => $sb_value) {
$this->tag .= Html::Tag('li', Html::a($sb_value["name"], $sb_value["href"]));
}
}
$this->tag .= Html::endTag('ul');
if (isset($value["childs"]) && !empty($value["childs"])) {
$this->MakePage($value["childs"]);
}
$this->tag .= Html::endTag('li');
}
$this->tag .= Html::endTag("ul");
return $this->tag;
}