Question

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.

Was it helpful?

Solution

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top