payu2107 / zii

Automatically exported from code.google.com/p/zii
0 stars 0 forks source link

foreach breaks when assigning menu item without url #30

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
When a menu item has no url and is set to active, the foreach breaks:

Description

Undefined offset: 0
Source File

/var/www/yii-1.1-dev/framework/zii/widgets/CMenu.php(204)

In line 204.

Solution: add && $item != array() to if()

Original issue reported on code.google.com by thyseus on 8 Mar 2010 at 11:04

GoogleCodeExporter commented 8 years ago
to make the problem more clear:

i haven't used an empty url but this one:

array('label'=>Yii::t('UserModule.user', 'Delete User'),
'url'=>array('submit'=>array('delete','id'=>$model->id),'confirm'=>Yii::t("UserM
odule.user",
'Are you sure to delete this item?'))),

commenting out this line makes CMenu work.

Original comment by thyseus on 8 Mar 2010 at 12:06

GoogleCodeExporter commented 8 years ago
Your 'url' is specified incorrectly. Note that this is passed to
CHtml::normalizeUrl(), not CHtml::link(). You may consider using the 'template'
option (available in svn).

Original comment by qiang.xue on 10 Mar 2010 at 8:24