forms - 如何使用 cakephp 和 twitter bootstrap 在 poSTLin

这给了我想要的:

<?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)
); ?>

但是当我创建一个 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)
); ?>

它给了我 <i class="glyphicon glyphicon-remove"></i> Delete

最佳答案

您忘记将选项 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')
);

关于forms - 如何使用 cakephp 和 twitter bootstrap 在 poSTLink 表单中创建图标,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22995651/

相关文章:

loops - JMeter while 循环(使用自己的索引停止循环)

visual-studio-code - 如何在 visual studio 代码中显示完整的长行(

proxy - JProfiler - 有防火墙时如何配置远程应用程序?

python - 如何在 Python 的特定范围内替换数据框中的数字?

jboss - 更改 Velocity.Log 文件的位置

macos - 检查签名工具失败并显示消息 : resource envelope is obsol

perl - Perl 中的并行计算

node.js - 为什么 bcryptjs 在 AWS Lambda 上比在本地 docker 上

macos - tmux没有在/private/tmp/tmux-502/default上运行的服务

maven - Intellij IDEA 不更新 pom.xml 文件