Here’s what I have inside my main layout. Its used for the main navigation:
$this->widget('application.components.MainMenu', array(
'activeCssClass' => 'navOn',
'items' => array(
array('label' => 'Home', 'url' => array('/site/index'), 'active' => isItemActive($this->route, 'site'), 'items' => SiteController::getSubNav()),
array('label' => 'Inbox', 'url' => array('/inbox/index'), 'active' => isItemActive($this->route, 'inbox'), 'items' => InboxController::getSubNav()),
array('label' => 'Payables', 'url' => array('/payables/index'), 'active' => isItemActive($this->route, 'payables')),
array('label' => 'Receivables', 'url' => array('/receivables/index'), 'active' => isItemActive($this->route, 'receivables')),
array('label' => 'Documents', 'url' => array('/documents/index'), 'active' => isItemActive($this->route, 'documents')),
array('label' => 'Reports', 'url' => array('/reports/index'), 'active' => isItemActive($this->route, 'reports')),
),
));
The problem is if I’m inside the Inbox controller, the SiteController:: call gets an error saying:
include(SiteController.php) [<a href='function.include'>function.include</a>]: failed to open stream: No such file or directory
The quick fix for this would be to manually include every controller needed in this layout but hoping there’s a more Yii way to do it.