How to add a class to 'span' in zii.widgets.CMenu

Hi all,

I’m in a situation where I need to add css class to the links of a menu. Here is my code:




<?php

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

		'items'=>array(

			array('label'=>'Home', 'url'=>array('site/index')),

		),

                'linkLabelWrapper' => 'span',

		'htmlOptions'=>array('class'=>'art-menu'),

	));

?>



which lets Yii render:




<ul class="art-menu" id="yw0">

    <li class="active">

        <a href="/app/index.php?r=site/index"><span>Donde comer</span></a>

    </li>

</ul>



However, what I actually need is to add a class into de span that is into de link, something like this:




<ul class="art-menu" id="yw0">

    <li class="active">

        <a href="/app/index.php?r=site/index"><span class="css_class">Home</span></a>

    </li>

</ul>



How can I do that?

Thanks a lot!

Alejandro.

Alejandro, take a look at this thread. It should cover what you’re doing.

template and CMenu

From your example, it looks like you’re using an Artisteer 2.x based theme. If that is the case, the thread above also mentions where you can find some examples.

Excelent answers in that thread. Very helpful mate, thanks!!

I’ve no idea what “Artisteer 2.x” is, but I got what I wanted.

Alejandro.