Preprocessing before

For example, you want to remove the html tags before showing it. How do you do something like this?


$m->getAttributes(array(strip_tags('description')))

if you trying to strip tags then it should be like so


strip_tags($m->getAttribute('description'))

Alternatively, if $m is child of CModel(/ActiveRecord) you can use filters:




class MyModel extends ActiveRecord {


    /**

     * @return array validation rules for model attributes.

     */

    public function rules()

    {

        return array(

            array('description', 'filter', 'strip_tags'),

            ...

        );

    }


}



These filters invoked with validation: $m->validate()