我正在尝试删除删除按钮名称并尝试在此处添加图标。我已成功添加,编辑此代码的图标
<a href="/cakeauth/users/edit/<?php echo $user['User']['id'];?>" class="btn btn-sm btn-warning">
<span class="glyphicon glyphicon-edit"></span>
</a>
现在在此删除按钮中如何添加引导程序图标?
echo $this->Form->postLink(__('Delete'),
array('action' => 'delete', $user['User']['id']),
array(), __('Are you sure you want to delete # %s?', $user['User']['id']));
答案 0 :(得分:4)
请添加以下行
array('esacpe',false)
OR
您应该尝试使用此代码。
echo $this->Form->postLink(
$this->Html->tag('i', '', array('class' => 'glyphicon glyphicon-remove')). " Delete",
array('action' => 'delete', $user['User']['id']),
array('escape'=>false),
__('Are you sure you want to delete # %s?', $user['User']['id']),
array('class' => 'btn btn-mini')
);
请参阅以下链接:
How to create icon inside form postlink with cakephp and twitter bootstrap
答案 1 :(得分:0)
cakePHP默认转义为html。请尝试以下方法;
echo $this->Form->postLink(__(' <i class="icon-remove-sign"></i>'),
array('action' => 'delete', $user['User']['id']),array('escape' => false),
array(), __('Are you sure you want to delete # %s?', $user['User']['id']));