CakePHP HTML Helper:链接中的图像被转义? [英] CakePHP HTML Helper: image within a link gets escaped?
问题描述
从Cake 1.2更新到1.3,我有一个嵌套在链接元素中的图片,都由HTML帮助生成。然而,嵌套图像的标记从<
转义为& gt;
等。我知道HTML帮助器现在默认转义的东西,但我不能让它改变这种行为。
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 >
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))
我添加了数组; false)
位从官方Cake文档($ options数组的一部分),但我仍然得到转义的图像标签。是否订单设置错误或更改比我知道吗?原始代码直接来自蛋糕1.2。
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.
推荐答案
第三个参数是选项数组:
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))
这篇关于CakePHP HTML Helper:链接中的图像被转义?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!