如何添加类的errorsummay没有删除头消息 [英] how can i add class to errorsummay without remove header message
问题描述
我试图添加一个css类到yii框架中的errorSummary(),但后添加类我没有标题错误默认
我怎么可以添加类的errorsummay没有删除头消息
I'm trying to add a css class to the errorSummary() in yii framwork but after add class i have not header error default
how can i add class to errorsummay without remove header message
<?php echo $form->errorSummary($model, '', '', array('class' => 'alert alert-error')); ?>
推荐答案
它是一个非常简单的
您可以传递您需要的类别,
you can pass the class you need this way,
<?php echo CHtml::errorSummary($model, null, null, array('class'=>'className')); ?>
或
<?php echo $form->errorSummary($model, null, null, array('class'=>'className')); ?>
因此,您可以在添加标题时添加类。
so this will allow you add the class while you have the header.
请点击此处了解详情: http:/ /www.yiiframework.com/doc/api/1.1/CActiveForm#errorSummary-detail
check here for more information : http://www.yiiframework.com/doc/api/1.1/CActiveForm#errorSummary-detail
因为您正在传递,所以会导致标头的空字符串问题。 $ header
since you are passing, empty string for header it causes the header issue. default value is null for $header
.
public string errorSummary(mixed $models, string $header=NULL, string $footer=NULL, array $htmlOptions=array ( ))
这篇关于如何添加类的errorsummay没有删除头消息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!