Gil*_*lko 2 forms tags cakephp twitter-bootstrap glyphicons
这给了我想要的东西:
<?php echo $this->Html->link(
$this->Html->tag('i', '', array('class' => 'glyphicon glyphicon-edit')) . " Edit",
array('action' => 'edit', $comment['Comment']['comment_id']),
array('class' => 'btn btn-mini', 'escape' => false)
); ?>
Run Code Online (Sandbox Code Playgroud)
但是当我创建一个Form postLink时,我不知道如何在它前面获取删除图标..
<?php echo $this->Form->postLink(
$this->Html->tag('i', '', array('class' => 'glyphicon glyphicon-remove')) . " Delete",
array('action' => 'delete', $comment['Comment']['comment_id']), null, __('Are you sure you want to delete # %s?', $comment['Comment']['comment_id']),
array('class' => 'btn btn-mini', 'escape' => false)
); ?>
Run Code Online (Sandbox Code Playgroud)
它给了我 <i class="glyphicon glyphicon-remove"></i> Delete
wal*_*Red 12
你忘了添加选项escape,以false
echo $this->Form->postLink(
$this->Html->tag('i', '', array('class' => 'glyphicon glyphicon-remove')). " Delete",
array('action' => 'delete', $comment['Comment']['comment_id']),
array('escape'=>false),
__('Are you sure you want to delete # %s?', $comment['Comment']['comment_id']),
array('class' => 'btn btn-mini')
);
Run Code Online (Sandbox Code Playgroud)
使用按钮
<?php echo $this->Form->postLink(
'<button class="btn btn-danger">
<i class="icon-trash icon-white"></i>
</button>',
array(
'action' => 'delete', $post['Post']['id']
),
array(
'class' => 'tip',
'escape' => false,
'confirm' => 'Are you sure ?'
));
?>
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
6817 次 |
| 最近记录: |