Controller :
Yii::import("xupload.models.XUploadForm"); //enciora
$photos = new XUploadForm;
$this->render('create', array(
'model' => $model,
'photos' => $photos
));
create: <?php echo
$this->renderPartial('_form',
array(
'model'=>$model,
'photos' => $photos
)); ?>
_form: <?php
$this->widget( 'xupload.XUpload', array(
'url' => Yii::app()->createUrl( "/encionmentDetail/upload"),
//our XUploadForm
'model' => $photos,
//We set this for the widget to be able to target our own form
'htmlOptions' => array('id'=>'encionment-detail-form'),
'attribute' => 'file',
'multiple' => true,
//Note that we are using a custom view for our widget
//Thats becase the default widget includes the 'form'
//which we don't want here
'formView' => 'application.views.encionmentDetail._form',
)
);
?>
错误:未定义变量:模型或未定义变量:照片。这是
创建时出现的错误。如果通过了一个模型,则它会正确显示。请帮忙
好吧,问题在于这一行 'formView' => 'application.views.encionmentDetail._form'
. 如果我删除此行,则没有错误。我应该怎么办 ?