I made a CWidget and I call is as below and I have the error Property "upMenu.items" is not defined,what is wrong?
<?php $this->widget('upMenu',array(
'items'=>Cats::model()->getUpmenu())) ?>
<?php
<ul>
<?php $i=0; foreach($items as $comment): ?>
<li <?php if ($i++==0) {?> class="first"<?php }?>>
<?php echo CHtml::link(CHtml::encode($comment['cat_name']),array('site/index','code'=>$comment['cat_code'])); ?>
</li>
<?php endforeach; ?>
<li><?php echo CHtml::link('Contact',array('site/contact')); ?></li>
</ul>
......
class upMenu extends CWidget
{
public function init()
{ parent::init();
// this method is called by CController::beginWidget()
}
public function run()
{
// this method is called by CController::endWidget()
}
protected function renderContent()
{
$this->render('upMenu');
}
public function getMenu()
{
return Cats::model()->getUpmenu();
}
}
?>