template and CMenu

Hi all,

I search for creating such menu:


<a href='...'><strong>My Label</strong><span>My explain</span></a>


But I’m unable to do this with CMenu

I try many configuration … but still doesn’t work (using template, and or linkLabelWrapper …)

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



                                    'template'=>'<strong>{menu}</strong><span>Sweet Home</span>',





                        )); ?>

I try this but it gives

<li ><strong><a href="...">Home</a></strong><span>Sweet Home</span></li>

Is there a way to do it with Cmenu without extanding CMenu class ?


I don’t believe there is. I had the same issue some time ago while trying to get Artisteer generated themes to work in Yii. I ended up creating a drop in replacement for CMenu (after extending it was broken by an upgrade). Go to Yii Themes Site - Bright Ideas Theme and download the theme (or any other Artisteer theme). ArtMenu.php is included in the download. ArtMenu includes a ‘prelinklabel’ and a ‘postlinklabel’ that will do what you want.


I found the solution without breaking or extending:



at first level of options description in CMenu. Not in items description. That was my fault at start and then nothing worked.

then you write anything you want in items label.

'label'=>'Home<span>Sweet Home</span>', OR 'label'=>'<strong>Home</strong><span>Sweet Home</span>',

That was as simple as this.


Nice. I may remove that part of ArtMenu customizations.

thanks for sharing this!!

Hi Ajaxian,

I just design my first template for yii in Artisteer. I’m to stuck on the Menu issue. Where precisely did you put the the code?


I just start learning Yii and PHP.

All the help is welcome.


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