Hello everybody,
I’m new to Yii, and is just starting on the development of a small project.
I have encountered my first problem, that i was not able to solve by my self.
The system has a top menu and a menu in the side, and this sidemenu, has to work dynamicly, but i can’t get the active to work on the sidebar…
In my controller, the code looks like this:
public $sidebarmenu = array(
array(
'label'=>'Start',
'url'=>array('index'),
'active'=> (strcasecmp(Yii::app()->controller->route, 'site/index') === 0) ? true : false,
'items'=>array(
array('label'=>'Create new post', 'url'=>array('create')),
array('label'=>'Manage posts', 'url'=>array('manage')),
),
),
array(
'label'=>'Overview',
'url'=>array('overview'),
'active'=> (strcasecmp(Yii::app()->controller->route, 'site/overview') === 0) ? true : false,
'items'=>array(
array('label'=>'Accounting', 'url'=>array('accounting')),
),
array(
'label'=>'Users',
'url'=>array('users')
),
);
Then in my sidebar view, it looks like this:
if(isset($this->sidebarmenu))
{
$this->widget('zii.widgets.CMenu', array(
'activeCssClass'=>'submenu-active',
'activateParents'=>true,
'activateItems'=>true,
'htmlOptions'=>array(
'class'=>'box'
),
'items'=>$this->sidebarmenu,
));
}
And the error i receave is:
Parse error: syntax error, unexpected '(' in C:\wamp\www\system\protected\controllers\SiteController.php on line 12
Call Stack
# Time Memory Function Location
1 0.0014 369512 {main}( ) ..\index.php:0
2 0.0500 1917792 CApplication->run( ) ..\index.php:13
3 0.0500 1917792 CWebApplication->processRequest( ) ..\CApplication.php:158
4 0.0570 2133968 CWebApplication->runController( ) ..\CWebApplication.php:136
5 0.0570 2133968 CWebApplication->createController( ) ..\CWebApplication.php:271
I hope you understand my question/code