CakePHP& Twitter Bootstrap CSS按钮图标 [英] CakePHP & Twitter Bootstrap CSS button icons

查看:155
本文介绍了CakePHP& Twitter Bootstrap CSS按钮图标的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有这个代码;

<?php echo $this->Form->postLink(__('Delete'), 
            array('action' => 'delete', $homepage['Homepage']['ContentID']),
            array('class'=>'btn icon-plus'),
            __('Are you sure you want to delete # %s?', $homepage['Homepage']['ContentID'])); ?>

它显示文本'Delete'我想把twitter的图标从twitter bootstrap css包。但是当我这样做;

Where it displays the text 'Delete' I would like to put the trashcan icon from the twitter bootstrap css package. However when I do;

<?php echo $this->Form->postLink(__('<i class="icon-trash"></i>')....

它只显示html而不是抓取图标。

It only displays the html rather than grabbing the icon.

任何人都可以解释为什么它这样做以及如何解决它?

Can anyone explain why its doing this and how I can resolve it?

推荐答案

向第三个参数添加'escape'=> false 选项。

Add 'escape' => false option to the third param.

<?php echo $this->Form->postLink(__('Delete'), 
            array('action' => 'delete', $homepage['Homepage']['ContentID']),
            array('class'=>'btn icon-plus', 'escape' => false),
            __('Are you sure you want to delete # %s?', $homepage['Homepage']['ContentID'])); ?>

这篇关于CakePHP&amp; Twitter Bootstrap CSS按钮图标的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆