问题
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