缩略图中的bootstrap链接

时间:2014-06-30 21:22:51

标签: cakephp hyperlink thumbnails

我想将缩略图显示为

       <div class="col-xs-6 col-md-2">
          <a href="/admin/contacts/index" class="thumbnail">
            <i class="fa fa-camera-retro fa-5x center-block"></i>
          </a>
        </div>

我试过但它显示的是html而不是图标

   <?php echo $this->Html->link(
                 '<i class="fa fa-envelope fa-5x center-block"></i>'
                               ),
                  array('controller'=>'contacts','action'=>'index','admin'=>true),
                array('class'=>'thumbnail')) ?>

1 个答案:

答案 0 :(得分:2)

使用转义属性

<?php echo $this->Html->link(
     '<i class="fa fa-envelope fa-5x center-block"></i>',
      array('controller'=>'contacts','action'=>'index','admin'=>true),
      array('escape'=>true,'class'=>'thumbnail')) ?>

Html->tag函数

<?php echo $this->Html->link(
      $this->Html->tag('i', '', array('class'=>'fa fa-envelope fa-5x center-block')),
      array('controller'=>'contacts','action'=>'index','admin'=>true),
      array('escape'=>true,'class'=>'thumbnail')) ?>

(我选择Html->tag功能)