Hi everybody!
I meeted Yii 2 days ago and I think it's the best choice for developer
Now i develop my first application with yii.
In form i want use CHtml::activeLabel, but how can i define not english $value.
When it is in Cirilic, it displeyed as abracatabra
As i undestand $value is used to bind with form field.
May be CHtml::activeLabel need to add additional parameter?
Regards!
qiang
(Qiang Xue)
January 29, 2009, 6:00pm
2
You need to define your labels in your model class' attributeLabels() method since you are not using the default labels.
Sorry
but hint me more detail please
i found only how to returns the attribute labels.
qiang
(Qiang Xue)
January 29, 2009, 6:52pm
4
CHtml::activeLabel determines what label to display for an attribute according to the information returned from attributeLabels() in the model class, like the following:
class MyModelClass extends CActiveRecord
{
public function attributeLabels()
{
return array(
'attributeName'=>'attributeName in Cirilic',
....
);
}
}
anli
(A)
January 29, 2009, 6:55pm
5
Say, in model:
public function attributeLabels() {
return array(
'name' => 'имя',
);
}
And in view:
<div class="simple">
<?php echo CHtml::activeLabel($user,'name'); ?>
<?php echo CHtml::activeTextField($user,'name') ?>
</div>
Of course, you must use UT8 encoding in your editor/IDE, and layout must have
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
...
</head>