I have upload a new form in an existing webapp which is live (Linux server). But I am not able to set the route properly and get error.
Files : 1. view/newform/(create,index,view,_view,_form).php
controllers/NewFormController.php
models/NewForm.php
main.php :
'urlManager' => array(
'showScriptName' => false,
'urlFormat' => 'path',
'rules' => array(
'/' => 'site/index',
'newform' => 'newform/create', /*This rule is for new form */
**********************************
Link I use to access the wbepage online :
websitename.com/newform/create or create.php (I get 404 not found)
websitename.com/NewForm/create or create.php (NewFormController cannot find the requested view "create" error )
I can view it properly on localhost(windows) => localhost/public_html/index.php?r=newform/create
Questions : What link should I use to view it online ? How to get correct Route to the form I created ?
Edited : I can view the index page after adding the path (/newform/index) in actionIndex(). controller
public function actionIndex()
{
$dataProvider=new CActiveDataProvider('NewForm');
$this->render('/newform/index',array(
'dataProvider'=>$dataProvider,
));
}
Here is the create function :
When I use this the error I get : cannot find the requested view "_form"
public function actionCreate()
{
$model=new NewForm;
// Uncomment the following line if AJAX validation is needed
// $this->performAjaxValidation($model);
if(isset($_POST['NewForm']))
{
$model->attributes=$_POST['NewForm'];
if($model->save())
$this->redirect(array('view','id'=>$model->id));
}
$this->render('/newform/create',array(
'model'=>$model,
));
}
Found It :P
$this->render('/newform/_form',array(
'model'=>$model,
));
in crontroller