Encoding HTML character in Yii -
i have following code chtml::encode($model->item);
in controller, manipulating $model->item adding space this
foreach($many_items $key => $value){ $model->item .= $value; $model->item .= ' '; } now, in view, see though want see space. have solution this?
thank you.
when encode html, special characters turned html. example:
echo chtml::encode('"'); // outputs " what need neither decoding nor encoding; stick character @ end of strings , should work.
as form of best practices , code readability, however, suggest cut part out of controller , put in widget. you:
- separate presentation code
- have thinner controllers, means code more testable , readable
Comments
Post a Comment