Module And Error Handling

Hi all,

I have setup module error handling as per this post : Error Handler for Modules It works great except that in my module layouts/main.php I have some references to


This reference is used to create the main menu links of my app like this :

array('label'=>'<span>Home</span>', 'url'=>array('/'.$this->module->id.'/site/index')),

array('label'=>'<span>Blog</span>', 'url'=>array('/'.$this->module->id.'/site/blog')),


and I can easily use my layout for multiple modules. But when an error is raised, I have errors for all my menu items that uses it.

Notice: Trying to get property of non-object in C:\~\themes\mymodule\views\layouts\main.php on line 41

Any reason why my module site controller doesn’t have a module object property when running the error action ?

P.S. As a quick fix, I know I can just change my menu url’s to

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

array('label'=>'<span>Blog</span>', 'url'=>array('/mymodule/site/blog')),


, but I’d like to understand and keep my theme flexible to use with any/many modules.

Using Yii 1.1.10