I am studying Yii and I have managed to create a skeleton pproject using the Yii framework. I am also reading a book and the book tells you to modify some code. Here is the code from the book typed exactly like it is in the book
<php>
<div id="mainmenu">
<?php
if (Yii::app()->user->isGuest) {
$this->widget('zii.widgets.CMenu', array(
'activeCssClass' => 'active',
'activateParents' => true,
'items'=>array(array('label'=>'Home',
'url'=>array('site/index')),
//array('label'=>'About',
'url'=>array('/site/page', 'view'=>'about')),
//array('label'=>'Contact',
'url'=>array('/site/contact')),
array('label'=>'Login', 'url'=>array('/site/login'))
)
;
} else {
$this->widget('zii.widget.Cmenu', array('activeCssClass' => 'active',
'activateParents' => true,
'items'=>array(array('label'=>'Home', 'url'=>array('/site/index')),
array('label'=>'Comic books', 'url'=>array('/Book'),
'items'=>array(array('label'=>'Publishers', 'url'=>array('/publisher')),
)
),
array('label'=>'Logout ('.Yii::app()->user->name.')', 'url'=>array('/site/logout'))
),
));
}
?>
</div><!-- mainmenu -->
I get an error on the site CExeption Property "CMenu.url" is not defined.
and here is the code from the Yii installation causing the exeption:
/opt/lampp/htdocs/yii/framework/web/CWidgetFactory.php(161)
149 if(isset($this->widgets[$className]))
150 $properties=$properties===array() ? $this->widgets[$className] : CMap::mergeArray($this->widgets[$className],$properties);
151 if($this->enableSkin)
152 {
153 if($this->skinnableWidgets===null || in_array($className,$this->skinnableWidgets))
154 {
155 $skinName=isset($properties['skin']) ? $properties['skin'] : 'default';
156 if($skinName!==false && ($skin=$this->getSkin($className,$skinName))!==array())
157 $properties=$properties===array() ? $skin : CMap::mergeArray($skin,$properties);
158 }
159 }
160 foreach($properties as $name=>$value)
161 $widget->$name=$value;
162 return $widget;
163 }
164
165 /**
166 * Returns the skin for the specified widget class and skin name.
167 * @param string $className the widget class name
168 * @param string $skinName the widget skin name
169 * @return array the skin (name=>value) for the widget
170 */
171 protected function getSkin($className,$skinName)
172 {
173 if(!isset($this->_skins[$className][$skinName]))
Please can someone show me what is wrong and how this works so I can better understand what I am doing wrong.