ezekel
(Dixunei)
October 9, 2014, 3:28pm
1
Hi I just want to ask why is it I am getting error undefined $modelInfo ?
in my Itemcontroller
public function actionCreate()
{
$model=new Item;
$modelInfo=new Info;
// Uncomment the following line if AJAX validation is needed
// $this->performAjaxValidation($model);
if(isset($_POST['Item']))
{
$model->attributes=$_POST['Item'];
if($model->save())
$this->redirect(array('view','id'=>$model->id));
}
$this->render('create',array(
'model'=>$model,
'modinf'=>$modelInfo
));
}
create.php
<?php
/* @var $this ItemController */
/* @var $model Item*/
$this->breadcrumbs=array(
'Item'=>array('index'),
'Create',
);
$this->menu=array(
array('label'=>'List Item', 'url'=>array('index')),
array('label'=>'Manage Item', 'url'=>array('admin')),
);
?>
<h1>Create Item</h1>
<?php $this->renderPartial('_form', array('model'=>$model, 'modinf'=>$modelInfo)); ?>//Here undefined //$modelInfo
can anyone help me why I am getting undefined but $modelInfo is in the array.
Sachy
(Sachin Mandalia)
October 9, 2014, 3:34pm
2
ezekel:
Hi I just want to ask why is it I am getting error undefined $modelInfo ?
in my Itemcontroller
public function actionCreate()
{
$model=new Item;
$modelInfo=new Info;
// Uncomment the following line if AJAX validation is needed
// $this->performAjaxValidation($model);
if(isset($_POST['Item']))
{
$model->attributes=$_POST['Item'];
if($model->save())
$this->redirect(array('view','id'=>$model->id));
}
$this->render('create',array(
'model'=>$model,
'modinf'=>$modelInfo
));
}
create.php
<?php
/* @var $this ItemController */
/* @var $model Item*/
$this->breadcrumbs=array(
'Item'=>array('index'),
'Create',
);
$this->menu=array(
array('label'=>'List Item', 'url'=>array('index')),
array('label'=>'Manage Item', 'url'=>array('admin')),
);
?>
<h1>Create Item</h1>
<?php $this->renderPartial('_form', array('model'=>$model, 'modinf'=>$modelInfo)); ?>//Here undefined //$modelInfo
can anyone help me why I am getting undefined but $modelInfo is in the array.
<?php $this->renderPartial('_form', array('model'=>$model, 'modinf'=>$modinf)); ?>//Here undefined //$modelInfo
in create.php, use $modinf instead of $modinfo