Extending CMenu Widget

Hi all

I don’t know how to extend the CMenu widget.

I did this:

in application/components/XMenu.php




class XMenu extends CMenu{

	

}



in my view




<?php $this->widget('application.components.XMenu',array(

							'items'=>array(

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

								array('label'=>'ABOUT US ', 'url'=>array('/site/about')),

								array('label'=>'SERVICES ', 'url'=>array('/site/services')),

								array('label'=>'RESERVATIONS ', 'url'=>array('/site/reservations')),

								array('label'=>'CONTACTS', 'url'=>array('/site/contacts')),

							),

						)); ?>



and i get the error


include(CMenu.php) [<a href='function.include'>function.include</a>]: failed to open stream: No such file or directory

I think I know why this happens, it is because the Zii widgets are not in the include path and so it cannot autoload the classes.

I think this is a basic question of extending widgets, but I don’t seem to find an answer.

Sorry but I don’t know how to fix it.

Can someone please help me.

Thanks

Hi tuga,

try this in application/components/XMenu.php:


Yii::import('zii.widgets.CMenu');


class XMenu extends CMenu{

        

}

I guess this should help. [not tested]

Best,

bettor

Thank you so much.

That worked nicely