$this->menu=array() not defined

i have this in the my index.php


	array('label'=>'Create content', 'url'=>array('create')),

	array('label'=>'Manage content', 'url'=>array('admin')),


but php can’t read it… i mean obviously not coz i dun have anything related to it in my site’s main Controller.

this error pops up:



Property "ContentController.menu" is not defined.

Source File


00001: <?php



00004: $this->menu=array(

00005:     array('label'=>'Create content', 'url'=>array('create')),

00006:     array('label'=>'Manage content', 'url'=>array('admin')),

00007: );

00008: ?>

00009: <p><center><em>Welcome to the Administrator Section</em></center></p>



00012: <h1>Contents</h1>


00014: <?php $this->widget('zii.widgets.CListView', array(

00015:     'dataProvider'=>$dataProvider,

00016:     'itemView'=>'_view',

Stack Trace

#0 C:\xampp\htdocs\viasatondemand\admin\protected\views\content\index.php(4): CComponent->__set('menu', Array)

#1 C:\xampp\yii\framework\yiilite.php(2851): require('C:\xampp\htdocs...')

#2 C:\xampp\yii\framework\yiilite.php(2830): CBaseController->renderInternal('C:\xampp\htdocs...', Array, true)

#3 C:\xampp\yii\framework\yiilite.php(3220): CBaseController->renderFile('C:\xampp\htdocs...', Array, true)

#4 C:\xampp\yii\framework\yiilite.php(3197): CController->renderPartial('index', Array, true)

#5 C:\xampp\htdocs\viasatondemand\admin\protected\controllers\ContentController.php(146): CController->render('index', Array)

#6 C:\xampp\yii\framework\yiilite.php(3430): ContentController->actionIndex()

#7 C:\xampp\yii\framework\yiilite.php(3002): CInlineAction->run()

#8 C:\xampp\yii\framework\yiilite.php(5655): CController->runAction(Object(CInlineAction))

#9 C:\xampp\yii\framework\yiilite.php(5664): CFilterChain->run()

#10 C:\xampp\yii\framework\yiilite.php(3334): CFilter->filter(Object(CFilterChain))

#11 C:\xampp\yii\framework\yiilite.php(5697): CController->filterAccessControl(Object(CFilterChain))

#12 C:\xampp\yii\framework\yiilite.php(5652): CInlineFilter->filter(Object(CFilterChain))

#13 C:\xampp\yii\framework\yiilite.php(2992): CFilterChain->run()

#14 C:\xampp\yii\framework\yiilite.php(2977): CController->runActionWithFilters(Object(CInlineAction), Array)

#15 C:\xampp\yii\framework\yiilite.php(1542): CController->run('index')

#16 C:\xampp\yii\framework\yiilite.php(1434): CWebApplication->runController('content/index')

#17 C:\xampp\yii\framework\yiilite.php(1049): CWebApplication->processRequest()

#18 C:\xampp\htdocs\viasatondemand\admin\index.php(11): CApplication->run()

#19 {main}

how do i fix this? T_T

As it says you don’t have $menu defined in ContentController…

yeah i know… how do i do that?.. i can’t find any format to follow for writing it.,

can i do it with a public function inside the class?

for instance something like this?

public function menu()





In the code generated automatically by Gii $menu is defined in components/Controller.php as public $menu=array() as a property of the Controler class

All other controlers extend from Controler class… maybe you extended your controler from CControler and so you don’t have ‘menu’?

yeah i think i did extend from CControler… t’was because when i extend from Controler this error pops up:

PHP Error


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

Source File


00180:         else

00181:             self::$_aliases[$alias]=rtrim($path,'\\/');

00182:     }

00183:     public static function autoload($className)

00184:     {

00185:         // use include so that the error PHP file may appear

00186:         if(isset(self::$_coreClasses[$className]))

00187:             include(YII_PATH.self::$_coreClasses[$className]);

00188:         else if(isset(self::$_classes[$className]))

00189:             include(self::$_classes[$className]);

00190:         else

00191:         {

00192: include($className.'.php');

00193:             return class_exists($className,false) || interface_exists($className,false);

00194:         }

00195:         return true;

00196:     }

00197:     public static function trace($msg,$category='application')

00198:     {

00199:         if(YII_DEBUG)

00200:             self::log($msg,CLogger::LEVEL_TRACE,$category);

00201:     }

00202:     public static function log($msg,$level=CLogger::LEVEL_INFO,$category='application')

00203:     {

00204:         if(self::$_logger===null)


as the error says it cannot find Controler.php… so check if the file exists in protected/components … and if in config/main.php under import you have ‘application.components.*’

If you still get some errors… then create a new webapp with yiic it creates all this settings and then add your controller to see if it works there…

i have this in my main config



Yii::setPathOfAlias('admin', $admin);

return array(


  'basePath'=> $frontend.'/protected',


  'controllerPath' => $admin.'/protected/controllers',

  'viewPath' => $admin.'/protected/views', 



  'sourceLanguage'=> 'en_US',

  'language' => 'ee',

  'timeZone' => 'Europe/Stockholm',


	// preloading 'log' component


	// autoloading model and component classes







i have controller.php in my components folder…

class Controller extends CController



	 * @var string the default layout for the controller view. Defaults to '//layouts/column1',

	 * meaning using a single column layout. See 'protected/views/layouts/column1.php'.


	public $layout='//layouts/column1';


	 * @var array context menu items. This property will be assigned to {@link CMenu::items}.


	public $menu=array();


	 * @var array the breadcrumbs of the current page. The value of this property will

	 * be assigned to {@link CBreadcrumbs::links}. Please refer to {@link CBreadcrumbs::links}

	 * for more details on how to specify this property.


	public $breadcrumbs=array();


it still shows this error…

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

Try renaming the controller.php to Controller.php (uppercase C)

tried that ady.

anyway… besides that, i got another weird problem…

i tried uploading all the stuff i had in a clients webserver.

everything went fine… except for the admin section [which worked fine on my computer’s local server]

i have a model called ‘content’ and that’s what the admin landing page uses as a content. it runs problem-free on my computer. but on the server it says:

Fatal error: Class 'content' not found in /home/earnpili/public_html/yii/framework/yiilite.php on line 6262

is there something wrong with the directories? i have the slightest idea. i’m a noob. ???