问题
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))
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