Issue
To generate the following markup:
<label class="foo">Bar</label>
The PHP will look something like:
<?php echo $form->label($model,'username'); ?>
Seems like it should be part of the htmlOptions parameter to label(), but I couldn't really figure it out.
From Yii's doc:
public string label(CModel $model, string $attribute, array $htmlOptions=array ( ))
Ref:
http://www.yiiframework.com/doc/api/1.1/CActiveForm#label-detail
Solution
As the doc says, $htmlOptions is an array of additional HTML attributes. The keys are the attribute, while the values are the attribute values, so to add a class attribute to the label:
<?php echo $form->label( $model,'username', array('class'=>'className') ); ?>
Answered By - ernie
0 Comments:
Post a Comment
Note: Only a member of this blog may post a comment.