How to call action() function in view page. I have created two controller. such as:
-ExamController.
-StaffController.
In my staffController, i create one action as actionStaffview(), and that view page is. staffview.php. In (staffview.php) that view page call one action of ExamController.
This is (staffview.php) view page coding:
$exam=new ExamController($id);
$exam->actionExamtype();
i.e: i create instance($exam) for ExamController and that action as $exam->actionExamType()(This action written inside of ExamController ).
Here that function($exam->actionExamType()) is calling, but nothing to be display. so, please tell solution for that problem.
Thanks for your reply. i saw that your solution. but in renderPartial(…array(‘data’=>)) we can not pass any data because here we can not assign values for that arguments(array(‘data’=>…)).i thing all arguments have null value, null value only pass that renderPartial() ($this->renderPartial(’…/event/viewEvents’, array(‘data’=>…)) . if null value pass that function means then how can we get exact output.
Yes, they are null unless you specify them. If you know you’re going to embed another action’s views, pass all the data to the main view, then pass it on to partial views.
Sure. As I’ve understood, you want to embed ExamController::actionExamType() into StaffController::actionStafview().
Assuming you’re storing all your data in your database, and representing table rows as ActiveRecord models, the embedding is just a little work.
Copy your exam/examtype action’s content into staff/staffview. For example:
public function actionStaffView()
{
... your original code ...
$examtypes = ExamTypesModel::model()->findAll(); // or something similar according to your application structure
$this->render('staffview', array('examtypes'=>$examtypes));
}
This way you can reach exam types from your views.