使用yii bootstrap扩展后,我得到白屏,不知道为什么?

时间:2013-10-26 08:56:58

标签: twitter-bootstrap yii

我使用过bootsrap YII扩展。它工作正常,直到我的本地主机,但是,当我转移到服务器时,它不起作用。我得到的只是白屏。当我删除表单以生成代码时,它工作正常。这是我的代码。我知道引导程序产生错误,但不知道哪一行。

    <?php
$form = $this->beginWidget('bootstrap.widgets.BootActiveForm', array(
    'id' => 'registration-form',
    'type' => 'horizontal',
    'enableAjaxValidation' => true,
    //'enableClientValidation'=>true,
    'clientOptions' => array(
        'validateOnSubmit' => true,
    )
        ));
?>
<?php echo $form->dropDownListRow($model, 'user_type', $model->getUserType(), array('class' => 'span4')); ?>
<?php echo $form->textFieldRow($model, 'user_id', array('class' => 'span4', 'placeholder' => 'Enter 6 digit pin which you can easily remember')); ?>
<?php echo $form->textFieldRow($model, 'username', array('class' => 'span4', 'placeholder' => 'Username')); ?>
<?php echo $form->passwordFieldRow($model, 'password_real', array('class' => 'span4', 'maxlength' => 30, 'placeholder' => 'Password')); ?>
<?php echo $form->passwordFieldRow($model, 'repeat_password', array('class' => 'span4', 'maxlength' => 30, 'placeholder' => 'Do not copy from above')); ?>
<?php echo $form->textFieldRow($model, 'firstname', array('class' => 'span4', 'placeholder' => 'Initial name')); ?>
<?php echo $form->textFieldRow($model, 'lastname', array('class' => 'span4', 'placeholder' => 'Family name')); ?>
<?php echo $form->textFieldRow($model, 'email', array('class' => 'span4', 'placeholder' => 'This will not be revealed')); ?>
<div class="control-group">
    <?php echo $form->labelEx($model, 'dob', array('class' => 'control-label')); ?>
    <div class="controls">
        <?php
        $this->widget('zii.widgets.jui.CJuiDatePicker', array(
            'model' => $model,
            'attribute' => 'dob',
            // additional javascript options for the date picker plugin
            'options' => array(
                //'showAnim'=>'fold',
                'changeMonth' => true,
                'changeYear' => true,
                'maxDate' => '-18y',
            ),
            'htmlOptions' => array(
                'class' => 'span4',
                'placeholder' => 'Choose from Date picker'
            ),
        ));
        ?></div>
    <?php echo $form->error($model, 'dob'); ?>
</div>
<?php echo $form->textFieldRow($model, 'profession', array('class' => 'span4', 'maxlength' => 255)); ?>

<?php echo $form->textFieldRow($model, 'hobby', array('class' => 'span4', 'maxlength' => 255, 'placeholder' => 'What you like most')); ?>
<div class="control-group" id="heightDiv">
    <?php echo $form->labelEx($model, 'height', array('class' => 'control-label')); ?>

    <div class="controls"><?php echo $form->textField($model, 'height', array('class' => 'span4', 'maxlength' => 20, 'placeholder' => 'Enter in CM')); ?> CM
        <?php echo $form->error($model, 'height'); ?></div>
</div>
<div class="control-group" id="weightDiv">
    <?php echo $form->labelEx($model, 'weight', array('class' => 'control-label')); ?>

    <div class="controls"><?php echo $form->textField($model, 'weight', array('class' => 'span4', 'maxlength' => 20, 'placeholder' => 'Enter in KG')); ?> KG
        <?php echo $form->error($model, 'weight'); ?></div>
</div>
<div class="control-group" id="weightTDiv">
    <?php echo $form::labelEx($model, 'weight_taken_on', array('class' => 'control-label')); ?>
    <div class="controls">

        <?php
        $this->widget('zii.widgets.jui.CJuiDatePicker', array(
            'model' => $model,
            'attribute' => 'weight_taken_on',
            // additional javascript options for the date picker plugin
            'options' => array(
                'showAnim' => 'fold',
                'changeMonth' => 'true',
                'changeYear' => 'true',
                'maxDate' => 'y',
            ),
            'htmlOptions' => array(
                'class' => 'span4',
                'placeholder' => 'Choose from Date picker'
            ),
        ));
        ?>
    </div>
</div>
<div class="line"></div>
<div class="control-group">
    <div class="controls">
        <?php
        $this->widget('bootstrap.widgets.BootButton', array(
            'buttonType' => 'submit',
            'type' => 'primary',
            'size' => 'large',
            'label' => $submit_btn,
        ));
        ?>
    </div>
</div>

<?php $this->endWidget(); ?>

1 个答案:

答案 0 :(得分:4)

您的代码看起来很好,除了在

行上
<?php echo $form::labelEx($model, 'weight_taken_on', array('class' => 'control-label')); ?>

将其替换为,

<?php echo $form->labelEx($model, 'weight_taken_on', array('class' => 'control-label')); ?>

它应该工作。