1
votes

I want to call a css class in html link tag using cakephp, i.e

 <li><a href="#"><i class="icon-trash"></i> Delete Account</a></li>

don't know how to do this, I've tried much but every time its disturbing my css, displays the icon before or above the link name, what I supposed to be in cake is

    <li> <?php echo $this->html->link('Delete Profile',
    array('controller'=>'Users','action'=>'delete',$current_user['user_id']),
    array('icon'=>'<i class="icon-trash">'.'</i>'),array('escape'=>false));?></li>

I am using cakephp 2.2.5 and xamp 1.7.7. thanks in advance.

2

2 Answers

0
votes

Your Html::link() is not correct. There is no icon param, and you have an extra array.

Use this:

<li>
<?php echo $this->Html->link('<i class="icon-trash"></i> Delete Profile', 
    array('controller'=>'users', 'action'=>'delete', $current_user['user_id']),
    array('escape'=>false)); ?>
</li>
0
votes

try below code that worked for me.

<?php 
echo $html->link
(
    '<i class="icon-trash"><i>'. __('Delete Profile', true),
    array('controller'=>'users','action'=>'delete', $current_user['user_id']),
    array('escape' => false), false
);
?>

Cheers and you are done.