Using Bootstrap Extension In Yii View.

Hi all,

I have a controller and a set of views for that controller,i want to use bootstrap for this views.

Problem is the model for this is not there.So how can i handle this.

Example Code,

<?php /** @var BootActiveForm $form */

$form = $this->beginWidget(‘bootstrap.widgets.TbActiveForm’);


<?php echo $form->textFieldRow($model, ‘textField’, array(‘class’=>‘input-small’)); ?>

<?php echo $form->passwordFieldRow($model, ‘password’, array(‘class’=>‘input-small’)); ?>

<?php $this->widget(‘bootstrap.widgets.TbButton’, array(‘buttonType’=>‘submit’, ‘label’=>‘Log in’)); ?>

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

Here what will be the $model in this case?

$model is whatever you’ve assigned to it in your controller/action

I am not having any model.So right now I am using Chtml to display form fields.

So what to assign for $model?

<div class="search-form">

<?php $form=$this->beginWidget(‘CActiveForm’, array(



)); ?>

&lt;?php echo CHtml::label('Name' ,''); ?&gt;

<?php echo CHtml::textField(‘name’, ‘’, array(‘size’=>60,‘maxlength’=>128)); ?>

&lt;?php echo CHtml::label('Qualification' ,''); ?&gt;


&#036;select = 1;

echo CHtml::dropDownList('qual', &#036;select, 

          array('0'=&gt;'BE','1'=&gt; 'MCA', '2' =&gt; 'MBA', '3' =&gt; 'MS',array('empty' =&gt; '(Select Qualification)','multiple'=&gt;'multiple'));


&lt;div class=&quot;clear&quot;&gt;&lt;/div&gt;&lt;br&gt;

&lt;?php echo CHtml::submitButton('Search'); ?&gt;

</div><!–search form–>

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

This is my view file,Here name and qual are just form fields.its not associated with any models.

So how can i add bootstrap to this form fields?

<div class="control-group ">

<?php echo CHtml::label(‘Name’ ,’’); ?>

<div class="controls">

<?php echo CHtml::textField(‘name’, ‘’, array(‘size’=>60,‘maxlength’=>128)); ?>

</div> </div>

and for class do like <?php echo CHtml::textField(‘name’, ‘’, array(‘class’=>‘myClass’,‘size’=>60,‘maxlength’=>128)); ?>