[SOLVED]Redirecting to a page

I want to redirect to a page once by form is submitted

now i am redirecting it to home page.


 if($model->validate())

       {

         $model->save();

				$this->redirect(Yii::app()->homeUrl);

            return;

        }

instead of that i need to redirect it to a page created by me.

I just know that we can do it like this


$this->redirect(array('controller/action'));

So for redirecting is it necessary to create a action for that in controller?

If so wat should i write inside that action??

Do you mean that you want to show the page that will display the newly created record?

If so, and if you already have an action to display an individual record in the same controller … I guess you should have it … then the following will do:




	$this->redirect(array('view','id'=>$model->id));



where ‘view’ stands for the action, ‘id’ for the parameter for it and ‘$model->id’ for PK.

You may want to change them according to your existing code.

No i know that to display… i want to display a new page written order placed successfully.

So i just want to know what action should i write in the controller

Ah, OK. I think I’ve got it.

You want a new page to show "Thank you for your order. Your order is …".

Yes, then you have to write a new action in the controller and a corresponding view script for it.

How about making use of "actionView" method and "view.php" script as the skeleton for your new page?

Ok… But how will i pass that msg instead of the model list being getting displayed?

Can you just tell me how to redirect to about us page?

using that method i will redirect to the new page i created.

The fixed messages like "Thank you very much" should be written with HTML code in the view script,

and the variables like item name, order amount, price, … etc should be retrieved from the database record that has been created. So you can pass just the id of the newly added record.

I have created a page like this…


<?php

$this->pageTitle=Yii::app()->name . ' -Confirmation';

$this->breadcrumbs=array(

	'Confirmation',

);

?>

<p>Successfully placed your order</p>




i want to redirect to this page…

Is it not simple to get it by this line of code




     $this->redirect(array('thanks','id'=>$model->id));



I Don’t have a model for my confirmation page…

Can u tell me how i can redirect a page to


"ABOUT US"

page which is already in the yii app

For this,

you need to give the path of the controller and action





 $this->redirect(array('site/thanks','id'=>$model->id));



It’s working for me after i did this


$this->redirect(array('/site/page', 'view'=>'confirmation'));