Remove The Header Layout

I am new in this framework,I tested to created my own controller via Gii tool,and I set as default controller in main.php,in my view I created a form log-in,when I run the site there is still default header ,how can i remove this I don’t want to have header in my log in form.I only want to show this default header after it logging-in.

Thank you in advance.


if(!Yii::app()->user->isGuest) {

    // show header

}

Try this…

you can create a separate layout for your login without a header and then in your login action you can setup the layout like so


// actionLogin

...

$this->layout = "//layouts/login";

...

Here is my Url

http://localhost/testyii/index.php?r=mysite/myindex

by the way if we create controller in gii tool,it always use the default layout for yii?..also I did not delete the sitecontroller maybe that is the reason why the default header is always shown.

This is




<?php


class MysiteController extends Controller

{

	public function actionMyindex()

	{

		$this->render('myindex');

	}


	// Uncomment the following methods and override them if needed

	/*

	public function filters()

	{

		// return the filter configuration for this controller, e.g.:

		return array(

			'inlineFilterName',

			array(

				'class'=>'path.to.FilterClass',

				'propertyName'=>'propertyValue',

			),

		);

	}


	public function actions()

	{

		// return external action classes, e.g.:

		return array(

			'action1'=>'path.to.ActionClass',

			'action2'=>array(

				'class'=>'path.to.AnotherActionClass',

				'propertyName'=>'propertyValue',

			),

		);

	}

	*/

}



views/mysite/myindex.php




   

<!DOCTYPE html>

<html lang="en">

<head>


   <style type="text/css">

     /*


      * some styling for my form here


      *

  

      *


     */





   </style>


</head>

<body>


  <form>

      username:  <input type="text" id="username" name="username">

      password:  <input type="text" id="password" name="password">


     <input type="submit" value="login" name="login">

  </form>


</body>


</html>






I am confuse in your suggestion about actionLogin,.In my MysiteController I am calling the login form which is in the views


  public function actionMyindex()

	{

		$this->render('myindex');//I render my view login form here as my default when page first load in browser

	}

myindex.php -->views/mysite/myindex.php




 <!DOCTYPE html>

<html lang="en">

<head>


   <style type="text/css">

     /*


      * some styling for my form here


      *

  

      *


     */





   </style>


</head>

<body>


  <form>

      username:  <input type="text" id="username" name="username">

      password:  <input type="text" id="password" name="password">


     <input type="submit" value="login" name="login">

  </form>


</body>


</html>




if you set layout property to false it would not render one


public function actionMyindex()

        {

$this->layout = false;  // right here set it to false

                $this->render('myindex');//I render my view login form here as my default when page first load in browser

        }