当前位置: 首页>>代码示例>>PHP>>正文


PHP Html::tag方法代码示例

本文整理汇总了PHP中yii\bootstrap\Html::tag方法的典型用法代码示例。如果您正苦于以下问题:PHP Html::tag方法的具体用法?PHP Html::tag怎么用?PHP Html::tag使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在yii\bootstrap\Html的用法示例。


在下文中一共展示了Html::tag方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: run

 public function run()
 {
     echo Html::beginTag('div', ['class' => 'input-group']);
     if (!isset($this->options['class'])) {
         $this->options['class'] = 'form-control';
     }
     $iconId = 'icon-' . $this->options['id'];
     if (!isset($this->options['aria-describedby'])) {
         $this->options['aria-describedby'] = $iconId;
     }
     if ($this->hasModel()) {
         $replace['{input}'] = Html::activeTextInput($this->model, $this->attribute, $this->options);
     } else {
         $replace['{input}'] = Html::textInput($this->name, $this->value, $this->options);
     }
     if ($this->icon != '') {
         $replace['{icon}'] = Html::tag('span', Icon::show($this->icon, [], Icon::FA), ['class' => 'input-group-addon', 'id' => $iconId]);
     }
     echo strtr($this->template, $replace);
     echo Html::endTag('div');
     $view = $this->getView();
     Assets::register($view);
     $idMaster = $this->hasModel() ? Html::getInputId($this->model, $this->fromField) : $this->fromField;
     $idSlave = $this->options['id'];
     $view->registerJs("\n        \$('#{$idMaster}').syncTranslit({\n            destination: '{$idSlave}',\n            type: 'url',\n            caseStyle: 'lower',\n            urlSeparator: '-'\n        });");
 }
开发者ID:sibds,项目名称:yii2-synctranslit,代码行数:26,代码来源:translitInput.php

示例2: getRoleLabel

 /**
  * Returns Bootstrap label widget with user's role
  * @param User $user
  * @return string
  */
 public function getRoleLabel(User $user)
 {
     $roles = [User::ROLE_USER => ['success', Yii::t('app', 'User')], User::ROLE_EDITOR => ['warning', Yii::t('app', 'Editor')], User::ROLE_ADMINISTRATOR => ['danger', Yii::t('app', 'Administrator')]];
     if (isset($roles[$user->role])) {
         return Html::tag('span', $roles[$user->role][1], ['class' => 'label label-' . $roles[$user->role][0]]);
     }
     return 'N/A';
 }
开发者ID:hauntd,项目名称:help-center,代码行数:13,代码来源:ManagementHelper.php

示例3: begin2

 public static function begin2($config = [])
 {
     $error = Html::tag('div', '{error}', ["class" => "col-lg-8"]);
     $input = Html::tag('div', '{input}', ["class" => "col-lg-4"]);
     $template = "{label}\n" . $input . $error;
     $config = ArrayHelper::merge(['options' => ['class' => 'form-horizontal'], 'fieldConfig' => ['template' => $template, 'labelOptions' => ['class' => 'col-lg-3 control-label']]], $config);
     return self::begin($config);
 }
开发者ID:carono,项目名称:yii2-components,代码行数:8,代码来源:ActiveForm.php

示例4: run

 public function run()
 {
     NavBar::begin(['brandLabel' => false, 'options' => ['class' => 'tor-nav']]);
     echo Html::tag('div', $this->torMenu(), ['class' => 'container']);
     NavBar::end();
     $view = $this->view;
     NavAsset::register($view);
 }
开发者ID:mark38,项目名称:yii2-tor,代码行数:8,代码来源:Tor.php

示例5: getAsHtml

 /**
  * @inheritdoc
  */
 public function getAsHtml()
 {
     $contentInfo = $this->getContentInfo($this->getCommentedRecord());
     if ($this->groupCount > 1) {
         return Yii::t('CommentModule.notification', "{displayNames} commented {contentTitle}.", array('displayNames' => $this->getGroupUserDisplayNames(), 'contentTitle' => $contentInfo));
     }
     return Yii::t('CommentModule.notification', "{displayName} commented {contentTitle}.", array('displayName' => Html::tag('strong', Html::encode($this->originator->displayName)), 'contentTitle' => $contentInfo));
 }
开发者ID:VasileGabriel,项目名称:humhub,代码行数:11,代码来源:NewComment.php

示例6: render

 /**
  * @return string
  */
 public function render()
 {
     if (isset($this->htmlOptions['class'])) {
         $this->htmlOptions['class'] = self::LAYER_CLASS . ' ' . $this->htmlOptions['class'];
     } else {
         $this->htmlOptions['class'] = self::LAYER_CLASS;
     }
     return \yii\bootstrap\Html::tag($this->tag, $this->content, $this->htmlOptions);
 }
开发者ID:edofre,项目名称:yii2-slider-pro,代码行数:12,代码来源:Layer.php

示例7: run

 public function run()
 {
     if ($this->torAd) {
         echo $this->render('full', ['torAd' => $this->torAd]);
     } else {
         echo Html::tag('div', '<em>По Вашему запросу ничего не найдено</em>', ['class' => 'text-center text-muted']);
     }
     $view = $this->view;
     TorAdsAsset::register($view);
 }
开发者ID:mark38,项目名称:yii2-tor,代码行数:10,代码来源:Full.php

示例8: viewMessage

 /**
  * Renders system message at frontend.
  *
  * @return string
  */
 public function viewMessage()
 {
     $alert = Yii::$app->session->getFlash('system-alert');
     $type = ArrayHelper::getValue($alert, 'type', self::INFO);
     $message = ArrayHelper::getValue($alert, 'message', '');
     if (!empty($message)) {
         return Html::tag('div', $message, ['class' => 'alert alert-' . $type]);
     }
     return '';
 }
开发者ID:kalyabin,项目名称:comitka,代码行数:15,代码来源:Alert.php

示例9: accountMenu

 public function accountMenu()
 {
     if (Yii::$app->user->isGuest) {
         $items[] = ['label' => 'Войти', 'url' => ['/site/login']];
         $items[] = ['label' => 'Зарегистрироваться', 'url' => ['/site/signup']];
     } else {
         $user = User::findOne(Yii::$app->user->id);
         $items[] = ['label' => $user->username . ' ' . Html::tag('span', preg_replace('/\\,00/', '', number_format($user->money, 2, ',', '&thinsp;')) . ' ' . Icon::show('user', ['class' => 'fa-btc'], Icon::FA), ['style' => 'margin: 0 2px 0 6px;']), 'items' => [['label' => 'Добавить лот на продажу', 'url' => ['/tor/mng-ad']], '<li class="divider"></li>', ['label' => 'Сменить пароль', 'url' => ['#']], ['label' => 'Выход', 'url' => ['/site/logout'], 'linkOptions' => ['data-method' => 'post']]]];
     }
     return $items;
 }
开发者ID:mark38,项目名称:yii2-tor,代码行数:11,代码来源:Top.php

示例10: renderDataCellContent

 /**
  * @inheritdoc
  */
 protected function renderDataCellContent($model, $key, $index)
 {
     if ($this->content === null) {
         $contentParts = [];
         $variationBehavior = $this->getVariationBehavior($model);
         foreach ($variationBehavior->getVariationModels() as $variationModel) {
             $contentParts[] = '<tr><td><b>' . $this->getVariationLabel($model, $variationModel) . '</b></td><td>' . $this->getVariationValue($variationModel) . '</td>';
         }
         return Html::tag('table', implode("\n", $contentParts), $this->tableOptions);
     }
     return parent::renderDataCellContent($model, $key, $index);
 }
开发者ID:yii2tech,项目名称:admin,代码行数:15,代码来源:VariationColumn.php

示例11: renderButton

 /**
  * Generates the button dropdown.
  * @return string the rendering result.
  */
 protected function renderButton()
 {
     // Html::addCssClass($this->options, ['widget' => 'btn']);
     $label = $this->label;
     $options = $this->options;
     if (!isset($options['href'])) {
         $options['href'] = '#';
     }
     Html::addCssClass($options, ['toggle' => 'dropdown-toggle']);
     $options['data-toggle'] = 'dropdown';
     return Html::tag($this->tagName, $label, $options) . "\n";
 }
开发者ID:roboapp,项目名称:admin,代码行数:16,代码来源:ButtonContextMenu.php

示例12: testGridBoxRender

 /**
  * @dataProvider gridDataProvider
  */
 public function testGridBoxRender($dataProvider)
 {
     $grid = GridBox::widget(['id' => 'gridbox-test-id', 'tools' => Html::tag('span', 'abc123', ['class' => '.tool-test']), 'dataProvider' => $dataProvider, 'columns' => ['id', ['attribute' => 'username', 'contentOptions' => ['class' => 'username']], 'email']]);
     $dom = new Crawler($grid);
     $root = $dom->filter('div#gridbox-test-id');
     $this->assertEquals('gridbox-test-id', $root->attr('id'));
     $this->assertEquals('grid-view box box-default', $root->attr('class'));
     $header = $root->filter('div.box-header');
     $tools = $header->filter('div.box-tools');
     $this->assertContains('abc123', $tools->text());
     $body = $root->filter('div.box-body');
     $this->assertEquals('box-body no-padding', $body->attr('class'));
     $this->assertNotNull($body->filter('table.table')->eq(0));
     $this->assertEquals('bar', $body->filter('tr[data-key="1"] td.username')->text());
     $footer = $header = $root->filter('div.box-footer');
     $this->assertContains('Showing 1-3 of 3 items.', $footer->text());
 }
开发者ID:webtoolsnz,项目名称:yii2-admin-lte,代码行数:20,代码来源:GridBoxTest.php

示例13: run

 public function run()
 {
     $link = Links::findOne(['url' => '/' . $this->url]);
     $this->links_id[] = $link->id;
     if ($link->child_exist == 1) {
         $this->getLinksId($link->id);
     }
     $ads = TorAds::find()->where(['links_id' => $this->links_id])->orderBy(['created_at' => SORT_ASC, 'price' => SORT_ASC])->limit(20)->all();
     $ads_promo = TorAds::find()->where(['links_id' => $this->links_id])->limit(5)->orderBy(['created_at' => rand()])->all();
     if ($ads) {
         echo $this->render('preview', ['ads' => $ads, 'ads_promo' => $ads_promo]);
     } else {
         echo Html::tag('div', '<em>Для заданных параметров товар не найден</em>', ['class' => 'text-center text-muted']);
     }
     $view = $this->view;
     TorAdsAsset::register($view);
 }
开发者ID:mark38,项目名称:yii2-tor,代码行数:17,代码来源:Preview.php

示例14: init

 /**
  * @inheritdoc
  */
 public function init()
 {
     if (!isset($this->options['id'])) {
         $this->options['id'] = $this->getId();
     }
     if ($this->requiresDjax()) {
         ob_start();
         ob_implicit_flush(false);
         $view = $this->getView();
         $view->clear();
         $view->beginPage();
         $view->head();
         $view->beginBody();
         if ($view->title !== null) {
             echo Html::tag('title', Html::encode($view->title));
         }
     } else {
         echo Html::beginTag('div', $this->options);
     }
 }
开发者ID:anmishael,项目名称:yii2-djax,代码行数:23,代码来源:Djax.php

示例15: initDefaultButtons

 /**
  * @inheritdoc
  */
 protected function initDefaultButtons()
 {
     if (!isset($this->buttons['enumeration-action'])) {
         $this->buttons['enumeration-action'] = function ($url, $model, $key) {
             $options = array_merge(['data-method' => 'POST', 'data-pjax' => '0', 'data-url' => $this->url, 'class' => 'btn btn-default btn-enumeration'], $this->buttonOptions);
             $options['title'] = $options['aria-label'] = $this->type == static::TypeLeft ? Yii::t('easyii', 'Enumeration|MoveRight') : Yii::t('easyii', 'Enumeration|MoveLeft');
             $options['data-status'] = $this->type == static::TypeLeft ? '1' : '0';
             if ($model instanceof Enumeration2Model) {
                 $options['data-owner-id'] = $this->enumeration->owner_id;
                 $options['data-model-id'] = $model->model->primaryKey;
             } else {
                 $options['data-owner-id'] = $this->enumeration->owner_id;
                 $options['data-model-id'] = $model->primaryKey;
             }
             if ($this->type == static::TypeLeft) {
                 return Html::a(Html::tag('span', '', ['class' => 'glyphicon glyphicon-menu-right']), $this->url, $options);
             } else {
                 return Html::a(Html::tag('span', '', ['class' => 'glyphicon glyphicon-menu-left']), $this->url, $options);
             }
         };
     }
 }
开发者ID:nanodesu88,项目名称:easyii,代码行数:25,代码来源:EnumerationColumn.php


注:本文中的yii\bootstrap\Html::tag方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。