我想使用cakePHP的formHelper::postLink函数输出一个包含超链接的图像,而不仅仅是一个文本超链接。
有人知道怎么做吗?我尝试了很多方法,但都不能让它工作。
<?php echo $this->Form->postLink(
'Delete',
array('action' => 'delete', $country['Country']['id']),
array('confirm' => __('Are you sure you want to delete ').$country['Country']['name'].'?')
)?>所以我想要显示一张图片,而不是“删除”。
发布于 2011-12-14 21:00:40
以下是对我有效的方法。
echo $this->Form->postLink(
$this->Html->image('icn_trash.png', array('alt' => __('Effacer'))), //le image
array('action' => 'delete', $artist['Artist']['id']), //le url
array('escape' => false), //le escape
__('Êtes-vous sûr de vouloir effacer artiste #%s?', $artist['Artist']['id']) //le confirm
); //le voila发布于 2011-11-18 17:41:34
试试这个:
echo $this->Form->postLink(
$this->Html->image('delete.png',
array("alt" => __('Delete'), "title" => __('Delete'))),
array('action' => 'delete', $items['Item']['id']),
array('escape' => false, 'confirm' => __('Are you sure?'))
);发布于 2011-11-13 00:16:09
如果我没理解错你的问题,我认为你不想用$this->Form->postLink
我想这个页面就是你想要的:http://book.cakephp.org/view/1441/image
这将使用$this->Html->image创建图像,然后您可以传递一个URL作为参数之一,以指定周围的锚点链接。
https://stackoverflow.com/questions/8105450
复制相似问题