build/commands/lite/protected/controllers/PostController.php
public function actionCreate()
	{
		$post=new Post;
		if(Yii::app()->request->isPostRequest)
		{
			if(isset($_POST['Post']))
				$post->setAttributes($_POST['Post']);
			if($post->save())
				$this->redirect(array('show','id'=>$post->id));
		}
		$this->render('create',array('post'=>$post));
	}
public function actionCreate()
	{
		$post=new Post;
		if(Yii::app()->request->isPostRequest)
		{
			if(isset($_POST['Post']))
				$post->setAttributes($_POST['Post']);
			if($post->save())
				$this->redirect(array('show','id'=>$post->id));
		}
		$this->render('create',array('post'=>$post));
	}
public function actionCreate ( ) { $ post = new Post ; if ( Yii :: app ( ) -> request -> isPostRequest ) { if ( isset ( $ _POST [ 'Post' ] ) ) $ post -> setAttributes ( $ _POST [ 'Post' ] ) ; if ( $ post -> save ( ) ) $ this -> redirect ( array ( 'show' , 'id' => $ post -> id ) ) ; } $ this -> render ( 'create' , array ( 'post' => $ post ) ) ; }
Creates a new post.
If creation is successful, the browser will be redirected to the 'show' page.
Creates a new post . If creation is successful the browser will be redirected to the show page .