1
是否可以使用CakePHP中的html助手創建帶有鏈接的圖像[$ confirmMessage]?
這是我目前的文本鏈接:
$this->Html->link('Clear list', array('controller' => 'items', 'action' => 'clearlist', $model['Model']['id']), array(), 'Clear list?')
此圖像助手如何與鏈接創建圖像:
echo $this->Html->image("recipes/6.jpg", array("alt" => "Brownies", 'url' => array('controller' => 'recipes', 'action' => 'view', 6)));
然而,這僅允許htmlattributes數組作爲arguements的鏈接。
$ confirmMessage提醒不是html屬性嗎?
這是我試過的代碼:
echo $this->Html->link($this->Html->image("clearall.png", array("alt" => "Clear list")), array('controller' => 'items', 'action' => 'clearlist', $model['Model']['id']), array(), 'Clear list?');
但是這個代碼打印正確的HTML我的IMG文本:
<img src="/img/clearall.png" alt="Clear list" />
我必須放棄的HtmlHelper在這種情況下?
如果您發現我的答案有幫助,請考慮接受它。 http://meta.stackexchange.com/questions/5234/how-does-accepting-an-answer-work – swiecki 2012-01-09 20:57:40
感謝彼得,縮進應該肯定會對PHP新手有幫助。 – swiecki 2012-03-01 20:00:56