CakePHP & Twitter Bootstrap CSS button icons

自作多情 提交于 2020-01-16 04:19:07

问题


I have this code;

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

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>')....

It only displays the html rather than grabbing the icon.

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


回答1:


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



回答2:


Check to make sure the path to the "glyphicons-halflings.png" file is correct. By default, this image should be located in a directory named "img" that is at the same level as the folder containing the bootstrap.css file (named "css" in the default download).

css/bootstrap.css
img/glyphicons-halflings.png

Check your error console to see if there are any requested files not found.



来源:https://stackoverflow.com/questions/13004567/cakephp-twitter-bootstrap-css-button-icons

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!