CakePHP HTML Helper: image within a link gets escaped?

谁说胖子不能爱 提交于 2019-12-02 02:10:59

问题


Updating from Cake 1.2 to 1.3 and I have an image nested in a link element, both generated by the HTML helper. The nested image's markup is however escaped from < to &gt; ect. I know the HTML helper now escapes stuff by default, but I can't get it to change this behavior.

This is the code generating an example image link:

$html->link($html->image('icons/small/navigation-back.gif', array('alt'=>"Move Left", 'border'=>"0"))
,'#',array('id'=>'options_left'), array('escape'=>false))

I added the array('escape'=>false) bit from the official Cake documentation (part of the $options array), but I still get escaped image tags. Is the order set wrong or did more change than I'm aware of? The original code is straight from cake 1.2.


回答1:


the third parameter is the options array:

$html->link($html->image('icons/small/navigation-back.gif', array('alt'=>"Move Left", 'border'=>"0"))
,'#',array('id'=>'options_left', 'escape'=>false))


来源:https://stackoverflow.com/questions/7263680/cakephp-html-helper-image-within-a-link-gets-escaped

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!