I am having some issues with the redirect.
My $this->redirect(array(‘view’,array(‘id’=>15)));
redirects to
/admin.php/banner/view?0[id]=15
But what i expected was
/admin.php/banner/view/15
How can i validate why the redirect is creating such a weird url?
It is only on a single controller.
Here is the full method.
public function actionCreate()
{
$model=new Banner;
// Uncomment the following line if AJAX validation is needed
// $this->performAjaxValidation($model);
if(isset($_POST['Banner']))
{
$model->attributes=$_POST['Banner'];
if(isset($_FILES['Banner']) && $_FILES['Banner']['name']['image_path'] != ""){
$uploadedFile=CUploadedFile::getInstance($model,'image_path');
$model->image_path=date("mdyHis") . $uploadedFile;
}
if($model->save()){
if(isset($model->image_path) && $model->image_path != ""){
$uploadedFile->saveAs('images/banner/'.$model->image_path);
}
$this->redirect(array('view',array('id'=>11)));
}
}
$this->render('create',array(
'model'=>$model,
));
}