如何在span标签cakephp中编写带有图像链接的辅助链接

时间:2016-02-21 09:10:08

标签: cakephp cakephp-2.0 cakephp-2.6

我想生成这个

<a href="/users/signup" class="sf-with-ul">
                                <span class="profile-avatar">
                                    <img alt="" src="img/avatar/anonymous.png" height="40" width="40">
                                </span>
                    </a>

我写过

 <?php echo $this->Html->link(
                        $this->Html->image('avatar/anonymous.png',array('height' =>40,'width'=>'40')), array('controller' => 'users', 'action' => 'signup'),
                        array('class' => 'sf-with-ul', 'escape' => false));?>

生成

<a href="/users/signup" class="sf-with-ul"><span class="profile-name"></span><img src="/FindTutor/img/avatar/anonymous.png" height="40" width="40" alt="" /></a> 

有任何帮助吗?提前谢谢。

1 个答案:

答案 0 :(得分:1)

你可以尝试这只是改变你的图像路径

<?php echo $this->Html->link('<span class="profile-avatar">'. $this->Html->image('home/logo.png',array('width'=>'40px','height'=>'40px'), array('alt' => '')), array('controller' => 'users', 'action' => 'signup' ), array('class' => 'sf-with-ul', 'escape' => false)).'</span>';?>