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


PHP Html::input方法代码示例

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


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

示例1:

    ?>
	    <?php 
    echo Html::input('hidden', 'contentselector', $contentSelector);
    ?>
	    <?php 
    echo Html::input('hidden', 'footerselector', $footerSelector);
    ?>
	    <?php 
    echo Html::input('hidden', 'createAssets', $createAssets);
    ?>
	    <?php 
    echo Html::input('hidden', 'createLayouts', $createLayouts);
    ?>
	    <?php 
    echo Html::input('hidden', 'folder', $folder);
    ?>
	    <?php 
    echo Html::input('hidden', 'step', '2');
    ?>
	    <?php 
    echo Html::endForm();
    ?>
	    <?php 
} else {
    echo '<div class="alert alert-danger">Couldn\'t find a file.</div>';
}
?>
    </div>
</div>
<?php 
$this->endContent();
开发者ID:serhatozles,项目名称:yii2-htmltemplateintegrator,代码行数:31,代码来源:controller.php

示例2:

<?php 
echo Html::beginForm(Yii::$app->request->url, 'post', ['class' => 'form-horizontal']);
?>
<section id="widget-grid">
    <div class="row">
        <article class="col-xs-12 col-sm-6 col-md-6 col-lg-6">
            <?php 
BackendWidget::begin(['title' => Yii::t('app', 'Common'), 'icon' => 'pencil', 'footer' => $this->blocks['submit']]);
?>
            <div class="form-group required">
                <?php 
echo Html::label(Yii::t('app', 'Group name'), 'group-name', ['class' => 'col-md-2 control-label']);
?>
                <div class="col-md-10"><?php 
echo Html::input('text', 'group-name', '', ['class' => 'form-control']);
?>
</div>
            </div>
            <div class="form-group">
                <?php 
echo Html::label(Yii::t('app', 'Require review'), 'group-require-review', ['class' => 'col-md-2 control-label']);
?>
                <div class="col-md-10"><?php 
echo Html::checkbox('group-require-review', false, ['class' => '']);
?>
</div>
            </div>
            <div class="form-group">
                <?php 
echo Html::label(Yii::t('app', 'Allow guest user to rate'), 'group-allow-guest', ['class' => 'col-md-2 control-label']);
开发者ID:tqsq2005,项目名称:dotplant2,代码行数:30,代码来源:group-create.php

示例3:

<?php 
echo Html::beginForm(Yii::$app->request->url, 'post', ['class' => 'form-horizontal']);
?>
<section id="widget-grid">
    <div class="row">
        <article class="col-xs-12 col-sm-6 col-md-6 col-lg-6">
            <?php 
BackendWidget::begin(['title' => Yii::t('app', 'Common'), 'icon' => 'pencil', 'footer' => $this->blocks['submit']]);
?>
            <div class="form-group">
                <?php 
echo Html::label(Yii::t('app', 'Group name'), 'group-name', ['class' => 'col-md-2 control-label']);
?>
                <div class="col-md-10"><?php 
echo Html::input('text', 'group-name', $group['rating_group'], ['class' => 'form-control']);
?>
</div>
            </div>
            <div class="form-group">
                <?php 
echo Html::label(Yii::t('app', 'Require review'), 'group-require-review', ['class' => 'col-md-2 control-label']);
?>
                <div class="col-md-10"><?php 
echo Html::checkbox('group-require-review', $group['require_review'], ['class' => '']);
?>
</div>
            </div>
            <div class="form-group">
                <?php 
echo Html::label(Yii::t('app', 'Allow guest user to rate'), 'group-allow-guest', ['class' => 'col-md-2 control-label']);
开发者ID:tqsq2005,项目名称:dotplant2,代码行数:30,代码来源:group-edit.php

示例4: renderRawInput

 /**
  * Renders raw form input based on the attribute settings
  *
  * @param string $attribute the name of the attribute
  * @param string $id the input identifier
  * @param array  $settings the attribute settings
  *
  * @return string the form input markup
  * @throws \yii\base\InvalidConfigException
  */
 protected static function renderRawInput($attribute, &$id, $settings = [])
 {
     $type = ArrayHelper::getValue($settings, 'type', self::INPUT_TEXT);
     $i = strpos($attribute, ']');
     $attribName = $i > 0 ? substr($attribute, $i + 1) : $attribute;
     if (!in_array($type, static::$_validInputs)) {
         throw new InvalidConfigException("Invalid input type '{$type}' configured for the attribute '{$attribName}'.'");
     }
     $value = ArrayHelper::getValue($settings, 'value', null);
     $options = ArrayHelper::getValue($settings, 'options', []);
     $id = str_replace(['[]', '][', '[', ']', ' '], ['', '-', '-', '', '-'], $attribute);
     $id = strtolower($id);
     if ($type === self::INPUT_WIDGET) {
         $id = empty($options['options']['id']) ? $id : $options['options']['id'];
         $options['options']['id'] = $id;
     } else {
         $id = empty($options['id']) ? $id : $options['id'];
         $options['id'] = $id;
     }
     if ($type === self::INPUT_STATIC || $type === self::INPUT_HIDDEN_STATIC) {
         $opts = $options;
         if ($type === self::INPUT_HIDDEN_STATIC) {
             $opts = ArrayHelper::getValue($settings, 'hiddenStaticOptions', []);
         }
         Html::addCssClass($opts, 'form-control-static');
         $out = Html::tag('p', $value, $opts);
         if ($type === self::INPUT_HIDDEN_STATIC) {
             return $out . Html::hiddenInput($attribute, $value, $opts);
         }
         return $out;
     }
     if (!isset($options['class']) && $type !== self::INPUT_CHECKBOX_BUTTON_GROUP && $type !== self::INPUT_RADIO_BUTTON_GROUP) {
         $options['class'] = 'form-control';
     }
     if (isset(static::$_basicInputs[$type])) {
         return Html::$type($attribute, $value, $options);
     }
     if (isset(static::$_dropdownInputs[$type])) {
         if (!isset($settings['items'])) {
             throw new InvalidConfigException("You must setup the 'items' array for attribute '{$attribName}' since it is a '{$type}'.");
         }
         $items = ArrayHelper::getValue($settings, 'items', []);
         return Html::$type($attribute, $value, $items, $options);
     }
     if ($type === self::INPUT_CHECKBOX || $type === self::INPUT_RADIO) {
         $enclosedByLabel = ArrayHelper::getValue($settings, 'enclosedByLabel', true);
         $checked = !empty($value) && $value !== false ? true : false;
         $out = Html::$type($attribute, $checked, $options);
         return $enclosedByLabel ? "<div class='{$type}'>{$out}</div>" : $out;
     }
     if ($type === self::INPUT_HTML5) {
         $html5type = ArrayHelper::getValue($settings, 'html5type', 'text');
         return Html::input($html5type, $attribute, $value, $options);
     }
     if ($type === self::INPUT_WIDGET) {
         $widgetClass = ArrayHelper::getValue($settings, 'widgetClass', []);
         if (empty($widgetClass) && !$widgetClass instanceof InputWidget) {
             throw new InvalidConfigException("A valid 'widgetClass' for '{$attribute}' must be setup and extend from 'yii\\widgets\\InputWidget'.");
         }
         $options['name'] = $attribute;
         $options['value'] = $value;
         return $widgetClass::widget($options);
     }
     if ($type === self::INPUT_RAW) {
         return ArrayHelper::getValue($settings, 'value', '');
     }
     return null;
 }
开发者ID:rumatakira,项目名称:yii2-builder,代码行数:78,代码来源:BaseForm.php

示例5: 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">
开发者ID:kusma007,项目名称:one-advanced,代码行数:31,代码来源:_poll.php

示例6:

echo app\widgets\Alert::widget(['id' => 'alert']);
?>

<div class="row">

    <?php 
$this->beginBlock('search-form');
?>
    <?php 
echo Html::beginForm('search', 'get', ['id' => 'code_sorter', 'class' => 'form-inline', 'role' => 'form']);
?>
    <?php 
echo Html::label('HTTP code: ', 'code');
?>
    <?php 
echo Html::input('text', 'ErrorMonitor[http_code]', null, ['class' => 'form-control']);
?>
    <?php 
echo Html::submitButton('Search', ['class' => 'btn btn-primary']);
?>
    <?php 
echo Html::endForm();
?>
    <?php 
$this->endBlock();
?>

    <div class="col-md-12">
        <?php 
echo DynaGrid::widget(['options' => ['id' => 'errors-grid'], 'columns' => ['url', ['class' => 'app\\backend\\components\\ActionColumn', 'options' => ['width' => '50px'], 'buttons' => [['url' => 'details', 'icon' => 'info', 'class' => 'btn-primary', 'label' => 'Detailed info']]]], 'theme' => 'panel-default', 'gridOptions' => ['dataProvider' => $dataProvider, 'filterModel' => $searchModel, 'panel' => ['heading' => '<h3 class="panel-title">' . $this->title . '</h3>', 'before' => $this->blocks['search-form']]]]);
?>
开发者ID:tqsq2005,项目名称:dotplant2,代码行数:31,代码来源:index.php

示例7:

			    <?php 
    echo Html::input('text', 'headerselector', 'header.header', ['class' => 'form-control']);
    ?>
<hr />
			    <?php 
    echo Html::label('Content Tag Selector:');
    ?>
			    <?php 
    echo Html::input('text', 'contentselector', 'section.content', ['class' => 'form-control']);
    ?>
<hr />
			    <?php 
    echo Html::label('Footer Tag Selector:');
    ?>
			    <?php 
    echo Html::input('text', 'footerselector', 'footer.footer', ['class' => 'form-control']);
    ?>
    		    </div>
    		</div>
    	    </div>
    	    <div class="col-md-6 text-center">
    		<div class="panel panel-default">
    		    <div class="panel-body">
			    <?php 
    echo Html::label('Template:');
    ?>
			    <?php 
    echo Html::dropDownList('folder', null, $themeList, ['class' => 'form-control']);
    ?>
<hr />
    			<div class="checkbox text-left">
开发者ID:serhatozles,项目名称:yii2-htmltemplateintegrator,代码行数:31,代码来源:client.php


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