Using CMenu for inserting image

Hi Anyone,

I wanted to insert 3 differents picture into one label by used of CMenu. The following is my code.

<?php $this->widget(‘zii.widgets.CMenu’,array(

'encodeLabel'=&gt;false,


'items'=&gt;array(


array('label'=&gt;'&lt;img src=&quot;'.Yii::app()-&gt;request-&gt;baseUrl.'/images/admin/Tab_Home.png&quot; /&gt;', 'url'=&gt;array('/index'), 'active'=&gt;Yii::app()-&gt;controller-&gt;id=='index'),

),)); ?>

Based on the code above, I can only add one picture into the label. I am trying to use table to put into

the 3 pictures but it is not work.

Can anyone help me on this problem? I have tried for many ways of doing it but it is not working.

i dont get it ? :mellow:




array('label'=>'<img src="'.Yii::app()->request->baseUrl.'/images/admin/Tab_Home.png" /><img src="'.Yii::app()->request->baseUrl.'/images/admin/Tab_Home1.png" /><img src="'.Yii::app()->request->baseUrl.'/images/admin/Tab_Home2.png" />', 'url'=>array('/index'), 



is that you want or each menu have its own image?




<?php $this->widget('zii.widgets.CMenu',array(

'encodeLabel'=>false,

'items'=>array(

array('label'=>'<img src="'.Yii::app()->request->baseUrl.'/images/admin/Tab_Home.png" />', 'url'=>array('/index'), 'active'=>Yii::app()->controller->id=='index'),

array('label'=>'<img src="'.Yii::app()->request->baseUrl.'/images/admin/Tab_Home1.png" />', 'url'=>array('/index'), 'active'=>Yii::app()->controller->id=='index'),

),)); ?>



:o

Hi fastcrash,

I want the 3 picture to be combined and put into one label and then write the own text into the middle picture.

In facts, the picture is look like button whereby it has left angle of one picture, middle picture and right picture. The reason of having 3 pictures instead of one picture (ie. button) is because I need to control with different language for the text. Therefore, the button is empty without text.

Sorry for any misunderstanding. Thanks you very much for your reply.

Best Regards,

Asiagis

oh… if that case you can merge the 3 image and add to the background of LI tag.

find ‘.actions li’ and add this class in file main.css




.actions li

{

	background:transparent url('../images/home.gif') no-repeat center center;

}



so your code should be




$this->widget('zii.widgets.CMenu',array(

'encodeLabel'=>false,

'items'=>array(

array('label'=>'Home', 'url'=>array('/index'), 'active'=>Yii::app()->controller->id=='index'),

),));



hope it help… :)

::)