[Solved] Yii-Imperavi-Redactor-Widget

Does anyone have an example on how to implement yii-imperavi-redactor-widget from this link https://github.com/yiiext/imperavi-redactor-widget ?

I can make it show up but it cannot save to the mysql database. Every time I saved, the formatting will be gone.

Thank you in advance for your help.

My mistake, I am using CmsInput extension where the post is clean.

I apologise for my mistake…

If someone need this, below is my solution:




...

        if (isset($_POST['Post'])) {

            $model->attributes = $_POST['Post'];

            

            // Get the original `content` and purify it

            $oriPost = Yii::app()->input->getOriginalPost('Post');

            $model->content = Yii::app()->input->purify($oriPost['content']);

            $model->content = Yii::app()->input->xssClean($model->content);


            if ($model->save()) {

                $this->redirect(array('view', 'id' => $model->id));

            }

        }

...