I’m just new to yii, how do you put a login form in the index.php view? It goes this way,
there should be a login form in the home page of my application.
I’m just new to yii, how do you put a login form in the index.php view? It goes this way,
there should be a login form in the home page of my application.
put login file code in index file ( in views ),
copy and paste actionLogin function in actionIndex function ( in SiteController ).
I also seriously recommend going through the yii blog for starters and that you constantly refer to the demo blog.
Welcome to the forum .
Thank you for the response, i tried this but i got an error Undefined variable: model in index file.
Check if you pass the $model variable (or whatever name it has) from your actionIndex to the render() method.
posting your code will get you quicker solution
simplest way :
1- create new yii application. (yiic webapp myapp)
2- in SiteController.php class add this new propriety:
public $defaultAction = 'login';
this works.thank you so much.
how do you redirect to the original index or any page once logged in?
in actionLogin()
change:
$this->redirect(Yii::app()->user->returnUrl);
to
$this->redirect('/site/index');
thank you very much.