Purify should use in controller or in model

Hi all,

I was confusing where should i do purify between controller and models, when i was having some input, should i do purify in controller and pass variable to models or i gonna apply purify only in the models? Can anyone suggest me the good way to using Yii purify?

In a model you can use it as a validation "rule" (a filter actually). Here is an example: http://www.yiiframework.com/doc/api/1.1/CHtmlPurifier

hi andy,

All my input was using CHtml input field as input, not using model(), so i am not able to use the validation "rule" right? The purify i have tried and i work fine, i just not very sure doing purify at controller is the best way or doing purify in models.

If you collect some user data, you can create a model class (extending CFormModel) with validation rules. It will be the true “Yii way” :D But if you don’t have a model, then why do you ask? You can use it anywhere, but usually it’s a model’s business.