开发者

cakephp link on image escape is not working

开发者 https://www.devze.com 2023-03-21 19:37 出处:网络
Image link in the cakephp is not working $this->Html->link( $this->Html->image(\'image\',a开发者_运维技巧rray(\'class\' => $class,

Image link in the cakephp is not working

$this->Html->link(  
      $this->Html->image('image',a开发者_运维技巧rray('class' => $class,
                'id' =>'img_id' )), somelink, array('onclick' =>'jQuery(this).modal({width:600,height:400,left:120,top:100}).open(); return false;'),
                                        array(),
                                        array('escape'=>false));

it will output

<a href='link' onclick='jQuery(this).modal({width:600,height:400}).open(); return false;'> &lt; img src='image_path' &gt;   

it is not escaping &lt and > even if i mention escape=>false, but i am not getting where i am missing?


You have too many arguements. Try this:

echo $this->Html->link(  
  $this->Html->image('image',array('class' => $class,
            'id' =>'img_id' )), 'foo', array('escape'=>false, 'onclick' =>'jQuery(this).modal({width:600,height:400,left:120,top:100}).open(); return false;')
);


echo $this->Html->link(  
 $this->Html->image('image',array('class' => $class,
        'id' =>'img_id' )), '#', array('escape'=>false, 'onclick' => 'jQuery(this).modal({width:600,height:400,left:120,top:100}).open(); return false;','class'=>'linkclass'));
0

精彩评论

暂无评论...
验证码 换一张
取 消