1

How could I do that with CHtml (this works within Yii too) ?

<button class="btn btn-app btn-warning">
    <i class="icon-undo bigger-230"></i>
    Undo
</button>

I've tried the following without success:

echo CHtml::link('myLabelText',array('MyController/index'), array(
    'class' =>'cMyOwnClass btn btn-app btn-warning',
    'icon'=>'icon-undo',
));

I see the button, connection to MyController is OK, CSS-classes are OK, but there is no icon.

Joshua Dwire
  • 5,415
  • 5
  • 29
  • 50

1 Answers1

2

You're providing the additional css info at the wrong place. Try this:

echo CHtml::link('<i class="icon-undo"></i> myLabelText',array('MyController/index'),array(
    'class'=>'cMyOwnClass btn btn-app btn-warning',
));

This will still generate a <a href="...">...</a>-style link, though.

DaSourcerer
  • 6,288
  • 5
  • 32
  • 55