phersey
(Pahersey)
August 6, 2012, 12:59pm
1
Displaying "&" instead of "&" in View file using CDetailView. I have a database with a varchar2 field that has an "&" in it, example: "Mom & Pop". It gets displayed as "Mom & Pop".
I used gii to create. In the view.php is the following.
[indent]array(‘name’=>‘DEALER_ID’, ‘value’=>CHtml::encode($model->dealer->dealer_name).[/indent]
I’m not sure if this is a database issue or how it is being displayed using CHtml.
Thank you.
abennouna
(Abennouna)
August 6, 2012, 1:51pm
2
Your answer is simple
http://www.yiiframework.com/doc/api/1.1/CHtml#encode-detail
If you follow the link you find there, you’ll read:
phersey
(Pahersey)
August 6, 2012, 3:20pm
3
I read through the link you gave me and tried using "decode" instead of "encode" and that worked.
[indent][/indent]‘value’=>CHtml::decode($model->dEALER->DEALER_NAME)
Not sure if that is what you meant but it worked.
I also tried
[indent][/indent]value’=>CHtml::encode(HTML_SPECIALCHARS($model->dEALER->DEALER_NAME))
but that didn’t work. Not sure where the “html_specialchars” goes.
I previously had tried " ‘filter’, ‘filter’=>‘html_entity_decode’ " in rules section but that didn’t do anything.
I’m new to using frameworks and object oriented coding. So far I really like this one.
Thank you.