Chtml Vs <A>

Hi Community,

I’ve the following code in a view:


<?php

      echo CHtml::link(

           CHtml::image(YII::app()->baseUrl.'/images/grafic.png','Name'),

                        array('customers')

           );

?>

It works, but can be replaced for a html <a> tag to use css sprites.

My question is: can i use css sprites using the CHtml class?

yes you can use image sprites definitely.




CHtml :: image( YII:: app()-> baseUrl. '/images/grafic.png' , 'Name' ),

array (

'style'=>"your style here or use id or class like ",

'class'=>'sprite1'

)

);