I have googled for partial views usage and benefits but I didn't get useful references so thought of posting a question here. Basically I have a list of common html code to place in a common file and call/load that view wherever it included to avoid duplication of code so that whenever if something needs to be changed I will not change in all places I will just modify at common view where I kept my code.
My question here is I can load that common view with 2 types that is from controller I can pass with a $data['variable_name'] and use that with 'variable_name directly in the view or I can simply load that common view within a view like '$this->load->view('common_folder_name/my_partial_view')'
I just want to know which method is the best one to use and benefits of using that method? Also any disadvantages of using that method.
Method:1
My_controller_name:
$data['users_types'] = $this->load->view('common/users_type',NULL,TRUE);
My_view_name:
<?php echo $users_types; ?>
Method:2
My_view_name:
$this->load->view('common/users_type');
Which method is best to use and benefits..! Any help would be appreciated, Thanks.