AsadYarKhan
AsadYarKhan

Reputation: 688

multiple view of multiple controller in single page Yii PHP

I have a problem in architect.I had two page order and registration and they were working using these views and controller separately.

1.registration(view),RegistrationForm(Form Model) and RegistrationConroller(Controller).

2.order(view),OrderForm(Form Model) and OrderController(Controller).

Now the problem is i have new requirement that is to display both order and registration view in a single page.when user submit it will register the user and place the order after validation.

The problem in this requirement is which controller is going to process there request because each view ( registration and order) had separate controller. Now should i make a new controller then It will require code repetition. Please suggest me the best way.

Upvotes: 0

Views: 1765

Answers (1)

adeelx
adeelx

Reputation: 605

Yii has an option by which you can import/serve actions defined in other controllers.

http://www.yiiframework.com/doc/api/1.1/CController#actions-detail

The link above details the process of defining external actions in your controller.

So in essence, you can refer to actions defined in Order Controller without replicating the code.

Upvotes: 1

Related Questions