linkOptions and itemOptions encode html in CMenu

hi, the linkOptions and itemOptions seems to be encoding the HTML content.

http://www.yiiframework.com/doc/api/1.1/CMenu#items-detail

I think this is a bug because I can’t even specify a proper path to an image, like:


'linkOptions'=>array('style'=>"background-image: url('/images/icon.png');")

The resulting HTML source is:


<a style="background-image: url('/images/icon.png');" href="#">Test</a>

edit: the text editor of this forum is converting the wrong output, even with the “code” tags… so in the above, replace the character ’ with & # 0 3 9 ; (all together)

Instead of the desired:


<a style="background-image: url('/images/icon.png');" href="#">Test</a>

You can’t set even a simple <img> tag because the “<” and “>” symbols will be encoded to be “&gt;” and “&lt;”

I’m using yii 1.1.10

If this is a bug, please provide a workaround while this is solved.

Thank you for your time.

Try:




'linkOptions'=>array('encode'=>false, 'style'=>"background-image: url('/images/icon.png');")'



Details (description for htmlOptions):

http://www.yiiframework.com/doc/api/1.1/CHtml#tag-detail

Thank you very much for your help, CeBe.

It is now working as expected, setting the ‘encode’ attribute to false.